refrain from asserting when callback is invoked with null sock or sock->ssl. Also adjust style.
@@ -965,7 +965,8 @@ static SSL_SESSION *on_async_resumption_get(SSL *ssl,
int h2o_socket_ssl_new_session_cb(SSL *s, SSL_SESSION *sess)
{
h2o_socket_t *sock = (h2o_socket_t *)SSL_get_app_data(s);
- assert(sock && sock->ssl);
+ if (sock == NULL || sock->ssl == NULL)
+ return 0;
SSL_SESSION *session = NULL;
if (!SSL_is_server(s) && sock->ssl->handshake.client.session_cache != NULL) {
@@ -986,7 +987,7 @@ int h2o_socket_ssl_new_session_cb(SSL *s, SSL_SESSION *sess)
* 0 - drop ref count
* 1 - keep ref count
*/
- return session ? 1 : 0;
+ return (session != NULL) ? 1 : 0;
}
static int on_async_resumption_new(SSL *ssl, SSL_SESSION *session)
