|
|
|
@ -551,9 +551,9 @@ static void __connection_destroy(conn_t *co)
|
|
|
|
|
/* free queue */
|
|
|
|
|
ERR_remove_state(0);
|
|
|
|
|
ERR_remove_thread_state(0);
|
|
|
|
|
ERR_free_strings();
|
|
|
|
|
|
|
|
|
|
/* update use count */
|
|
|
|
|
usleep(1500);
|
|
|
|
|
_CONN_NOTINUSE(co);
|
|
|
|
|
|
|
|
|
|
/* ok, let's free other if we can */
|
|
|
|
@ -992,8 +992,8 @@ conn_t *connection_master_link(conn_sys_t *ssys, int sck, struct in_addr *addr)
|
|
|
|
|
/* set the context to verify ssl connection */
|
|
|
|
|
SSL_set_ex_data(co->ssl, ex_ssldata_index, (void *)co);
|
|
|
|
|
SSL_set_accept_state(co->ssl);
|
|
|
|
|
// if(SSL_accept(co->ssl) == -1) { r = SNE_EPERM; goto __fail; } /* leak here ? */
|
|
|
|
|
SSL_do_handshake(co->ssl);
|
|
|
|
|
if(SSL_accept(co->ssl) == -1) { r = SNE_EPERM; goto __fail; } /* leak here ? */
|
|
|
|
|
// SSL_do_handshake(co->ssl);
|
|
|
|
|
|
|
|
|
|
/* ok, now we are able to allocate and so on */
|
|
|
|
|
/* set connection to the batch mode */
|
|
|
|
@ -1029,6 +1029,7 @@ conn_t *connection_master_link(conn_sys_t *ssys, int sck, struct in_addr *addr)
|
|
|
|
|
if(!head->payload_length) continue; /* pass the following check up */
|
|
|
|
|
|
|
|
|
|
rd = __conn_read(co, bbuf, head->payload_length);
|
|
|
|
|
if(rd == -1) { r = SNE_LINKERROR; goto __fail3; }
|
|
|
|
|
if(rd != head->payload_length) { r = SNE_LINKERROR; goto __fail3; }
|
|
|
|
|
bbuf[rd] = '\0';
|
|
|
|
|
sx = parse_sexp(bbuf, rd);
|
|
|
|
@ -1048,6 +1049,7 @@ conn_t *connection_master_link(conn_sys_t *ssys, int sck, struct in_addr *addr)
|
|
|
|
|
goto __fail3;
|
|
|
|
|
}
|
|
|
|
|
rd = __conn_write(co, buf, sizeof(sntllv2_head_t) + msg->mhead.payload_length);
|
|
|
|
|
if(rd == -1) { r = SNE_LINKERROR; goto __fail3; }
|
|
|
|
|
if(rd != sizeof(sntllv2_head_t) + msg->mhead.payload_length) {
|
|
|
|
|
destroy_sexp(sx);
|
|
|
|
|
goto __fail3;
|
|
|
|
@ -1107,7 +1109,13 @@ conn_t *connection_master_link(conn_sys_t *ssys, int sck, struct in_addr *addr)
|
|
|
|
|
SSL_shutdown(co->ssl);
|
|
|
|
|
__fail:
|
|
|
|
|
if(co) {
|
|
|
|
|
if(co->ssl) SSL_free(co->ssl);
|
|
|
|
|
if(co->ssl) {
|
|
|
|
|
ERR_remove_thread_state(0);
|
|
|
|
|
ERR_remove_state(0);
|
|
|
|
|
ERR_free_strings();
|
|
|
|
|
|
|
|
|
|
SSL_free(co->ssl);
|
|
|
|
|
}
|
|
|
|
|
__connection_minimal_free(co);
|
|
|
|
|
}
|
|
|
|
|
close(sck);
|
|
|
|
|