|
|
|
@ -1929,6 +1929,7 @@ int connections_subsystem_init(void)
|
|
|
|
|
conn_sys->rootca = conn_sys->certkey = conn_sys->certpem = NULL;
|
|
|
|
|
conn_sys->validate_sslpem = NULL;
|
|
|
|
|
conn_sys->secure_check = NULL;
|
|
|
|
|
conn_sys->on_destroy = NULL;
|
|
|
|
|
/* init connections list */
|
|
|
|
|
usrtc_init(conn_sys->connections, USRTC_REDBLACK, MAX_CONNECTIONS,
|
|
|
|
|
__cmp_cstr);
|
|
|
|
@ -2388,7 +2389,7 @@ int connection_create(conn_t *co, int sck)
|
|
|
|
|
/* shutdown connection */
|
|
|
|
|
goto __fail_3;
|
|
|
|
|
} /* if success we're ready to use established SSL channel */
|
|
|
|
|
printf("%s:%d\n", __FUNCTION__, __LINE__);
|
|
|
|
|
|
|
|
|
|
BIO_set_nbio(SSL_get_rbio(co->ssl), 1);
|
|
|
|
|
/*******************************************/
|
|
|
|
|
/*-=Protocol part of connection establish=-*/
|
|
|
|
@ -2490,7 +2491,12 @@ static void __connection_free(conn_t *co)
|
|
|
|
|
pthread_join(co->msgthread, &nil); /* wait for it */
|
|
|
|
|
/* since we don't have any threads working with channels destroy them */
|
|
|
|
|
__destroy_all_channels(co);
|
|
|
|
|
/* TODO: permission context and callbacks */
|
|
|
|
|
/* permission context and callback of exists */
|
|
|
|
|
if(conn_sys->on_destroy) conn_sys->on_destroy(co);
|
|
|
|
|
else { /* we don't have a handler */
|
|
|
|
|
if(co->pctx->login) free(co->pctx->login);
|
|
|
|
|
if(co->pctx->passwd) free(co->pctx->passwd);
|
|
|
|
|
}
|
|
|
|
|
__connections_subsystem_connection_remove(co);
|
|
|
|
|
/* now we're ready to free other resources */
|
|
|
|
|
if(co->uuid) free(co->uuid);
|
|
|
|
@ -2508,6 +2514,8 @@ static void __connection_free(conn_t *co)
|
|
|
|
|
/* locks */
|
|
|
|
|
pthread_rwlock_destroy(&(co->chnl_lock));
|
|
|
|
|
pthread_mutex_destroy(&(co->oplock));
|
|
|
|
|
/* kill permission context */
|
|
|
|
|
if(co->pctx) free(co->pctx);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|