diff options
| author | Daniel Stenberg <daniel@haxx.se> | 2011-11-17 23:55:36 +0100 | 
|---|---|---|
| committer | Daniel Stenberg <daniel@haxx.se> | 2011-11-17 23:57:21 +0100 | 
| commit | 10ecdf5078f1f096c3b2d247ef08d35b8fa96f4a (patch) | |
| tree | bdf7566f96c092ba5135b279d07353f7353d630a | |
| parent | bb4eb589969c6191720295e59d510cb1d8f9c0ce (diff) | |
getsessionid: don't ever return while locked
Also, check for the session sharing bit instead of comparing pointers
| -rw-r--r-- | lib/sslgen.c | 22 | 
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/sslgen.c b/lib/sslgen.c index 23c07e73b..b9176b76c 100644 --- a/lib/sslgen.c +++ b/lib/sslgen.c @@ -233,14 +233,18 @@ int Curl_ssl_getsessionid(struct connectdata *conn,    struct SessionHandle *data = conn->data;    long i;    long *general_age; +  bool no_match = TRUE; + +  *ssl_sessionid = NULL;    if(!conn->ssl_config.sessionid)      /* session ID re-use is disabled */      return TRUE; -  /* Lock for reading if shared */ -  if(data->share && data->share->sslsession == data->state.session) { -    Curl_share_lock(data, CURL_LOCK_DATA_SSL_SESSION, CURL_LOCK_ACCESS_SHARED); +  /* Lock if shared */ +  if(data->share && +     (data->share->specifier & (1<<CURL_LOCK_DATA_SSL_SESSION)) ) { +    Curl_share_lock(data, CURL_LOCK_DATA_SSL_SESSION, CURL_LOCK_ACCESS_SINGLE);      general_age = &data->share->sessionage;    }    else @@ -260,17 +264,17 @@ int Curl_ssl_getsessionid(struct connectdata *conn,        *ssl_sessionid = check->sessionid;        if(idsize)          *idsize = check->idsize; -      return FALSE; +      no_match = FALSE; +      break;      }    } -  *ssl_sessionid = NULL; -  /* Unlock for reading */ -  if(data->share && data->share->sslsession == data->state.session) +  /* Unlock */ +  if(data->share && +     (data->share->specifier & (1<<CURL_LOCK_DATA_SSL_SESSION)) )      Curl_share_unlock(data, CURL_LOCK_DATA_SSL_SESSION); - -  return TRUE; +  return no_match;  }  /*  | 
