[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] cleanup the neon socket when closing the ra_session

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: 2007-07-06 19:53:19 CEST

Daniel Rall wrote:
> On Thu, 05 Jul 2007, Stefan Küng wrote:
>
>> Garrett Rooney wrote:
>>> On 7/5/07, Stefan Küng <tortoisesvn@gmail.com> wrote:
>>>> in ra_open(), the ne_sock_init() is called. But the ne_sock_exit() isn't
>>>> called when the session is closed. The attached patch fixes this.
>>> Is this safe from a thread-safety perspective?
>> According to the comments in the neon source, yes.
>
> I looked over the Neon sources and this patch certainly looks
> process-safe. Code in socket initialization and shutdown routines
> certainly seems to adhere to the comments:
>
> /* Perform process-global initialization of any libraries in use.
> * Returns non-zero on error. */
> int ne_sock_init(void);
>
> /* Perform process-global shutdown of any libraries in use. This
> * function only has effect when it has been called an equal number of
> * times to ne_sock_init() for the process. */
> void ne_sock_exit(void);
>
> Here's an example of Neon's OpenSSL shutdown code, called from
> ne_sock_exit():
>
> void ne__ssl_exit(void)
> {
> /* Cannot call ERR_free_strings() etc here in case any other code
> * in the process using OpenSSL. */
>
> #ifdef NE_HAVE_TS_SSL
> /* Only unregister the callbacks if some *other* library has not
> * come along in the mean-time and trampled over the callbacks
> * installed by neon. */
> if (CRYPTO_get_locking_callback() == thread_lock_neon
> && CRYPTO_get_id_callback() == thread_id_neon) {
> size_t n;
>
> CRYPTO_set_id_callback(NULL);
> CRYPTO_set_locking_callback(NULL);
>
> for (n = 0; n < num_locks; n++) {
> pthread_mutex_destroy(&locks[n]);
> }
>
> free(locks);
> }
>
>
> Was there something in particular which made it also look thread-safe,
> Stefan? I didn't think it was safe to equate process with thread on
> all platforms.

Well, I'm not that familiar with the neon code, but from what I can see
it should be thread safe. But just to be sure, I've cc'ed Joe Orton. I
guess he's the one who could clear this issue up.

Joe, is the ne_sock_exit() function thread-safe? If not, then when
should this be called?

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.net
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Jul 6 19:53:05 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.