Skip to content

Commit

Permalink
Merge pull request #1185 from h2o/i110/no-remove-session-cache
Browse files Browse the repository at this point in the history
stop removing session cache from memcached
  • Loading branch information
kazuho committed Feb 2, 2017
2 parents 36d75bf + 221135b commit fd12da0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 20 deletions.
3 changes: 1 addition & 2 deletions include/h2o/socket.h
Expand Up @@ -294,8 +294,7 @@ void h2o_socket_ssl_resume_server_handshake(h2o_socket_t *sock, h2o_iovec_t sess
/**
* registers callbacks to be called for handling session data
*/
void h2o_socket_ssl_async_resumption_init(h2o_socket_ssl_resumption_get_async_cb get_cb, h2o_socket_ssl_resumption_new_cb new_cb,
h2o_socket_ssl_resumption_remove_cb remove_cb);
void h2o_socket_ssl_async_resumption_init(h2o_socket_ssl_resumption_get_async_cb get_cb, h2o_socket_ssl_resumption_new_cb new_cb);
/**
* setups the SSL context to use the async resumption
*/
Expand Down
13 changes: 1 addition & 12 deletions lib/common/socket.c
Expand Up @@ -132,7 +132,6 @@ const char *h2o_socket_error_ssl_decode = "SSL decode error";

static void (*resumption_get_async)(h2o_socket_t *sock, h2o_iovec_t session_id);
static void (*resumption_new)(h2o_iovec_t session_id, h2o_iovec_t session_data);
static void (*resumption_remove)(h2o_iovec_t session_id);

static int read_bio(BIO *b, char *out, int len)
{
Expand Down Expand Up @@ -828,13 +827,6 @@ static int on_async_resumption_new(SSL *ssl, SSL_SESSION *session)
return 0;
}

static void on_async_resumption_remove(SSL_CTX *ssl_ctx, SSL_SESSION *session)
{
unsigned idlen;
const unsigned char *id = SSL_SESSION_get_id(session, &idlen);
resumption_remove(h2o_iovec_init(id, idlen));
}

static void on_handshake_complete(h2o_socket_t *sock, const char *err)
{
if (err == NULL) {
Expand Down Expand Up @@ -1053,19 +1045,16 @@ void h2o_socket_ssl_resume_server_handshake(h2o_socket_t *sock, h2o_iovec_t sess
}
}

void h2o_socket_ssl_async_resumption_init(h2o_socket_ssl_resumption_get_async_cb get_async_cb,
h2o_socket_ssl_resumption_new_cb new_cb, h2o_socket_ssl_resumption_remove_cb remove_cb)
void h2o_socket_ssl_async_resumption_init(h2o_socket_ssl_resumption_get_async_cb get_async_cb, h2o_socket_ssl_resumption_new_cb new_cb)
{
resumption_get_async = get_async_cb;
resumption_new = new_cb;
resumption_remove = remove_cb;
}

void h2o_socket_ssl_async_resumption_setup_ctx(SSL_CTX *ctx)
{
SSL_CTX_sess_set_get_cb(ctx, on_async_resumption_get);
SSL_CTX_sess_set_new_cb(ctx, on_async_resumption_new);
SSL_CTX_sess_set_remove_cb(ctx, on_async_resumption_remove);
/* if necessary, it is the responsibility of the caller to disable the internal cache */
}

Expand Down
7 changes: 1 addition & 6 deletions lib/core/util.c
Expand Up @@ -91,16 +91,11 @@ static void async_resumption_new(h2o_iovec_t session_id, h2o_iovec_t session_dat
H2O_MEMCACHED_ENCODE_KEY | H2O_MEMCACHED_ENCODE_VALUE);
}

static void async_resumption_remove(h2o_iovec_t session_id)
{
h2o_memcached_delete(async_resumption_context.memc, session_id, H2O_MEMCACHED_ENCODE_KEY);
}

void h2o_accept_setup_async_ssl_resumption(h2o_memcached_context_t *memc, unsigned expiration)
{
async_resumption_context.memc = memc;
async_resumption_context.expiration = expiration;
h2o_socket_ssl_async_resumption_init(async_resumption_get, async_resumption_new, async_resumption_remove);
h2o_socket_ssl_async_resumption_init(async_resumption_get, async_resumption_new);
}

void on_accept_timeout(h2o_timeout_entry_t *entry)
Expand Down

0 comments on commit fd12da0

Please sign in to comment.