fixes
This commit is contained in:
parent
ee20e42fea
commit
0856920e29
@ -457,7 +457,6 @@ static int send_socket_to_general_relay(ioa_engine_handle e, struct message_to_r
|
||||
int success = 0;
|
||||
|
||||
if(!rdest) {
|
||||
success = -1;
|
||||
goto label_end;
|
||||
}
|
||||
|
||||
@ -719,6 +718,7 @@ static int handle_relay_message(relay_server_handle rs, struct message_to_relay
|
||||
"%s: socket wrongly preset: 0x%lx : 0x%lx\n",
|
||||
__FUNCTION__, (long) s->read_event, (long) s->bev);
|
||||
IOA_CLOSE_SOCKET(s);
|
||||
sm->m.sm.s = NULL;
|
||||
} else {
|
||||
s->e = rs->ioa_eng;
|
||||
open_client_connection_session(&(rs->server), &(sm->m.sm));
|
||||
@ -756,6 +756,7 @@ static int handle_relay_message(relay_server_handle rs, struct message_to_relay
|
||||
"%s: mobile socket wrongly preset: 0x%lx : 0x%lx\n",
|
||||
__FUNCTION__, (long) s->read_event, (long) s->bev);
|
||||
IOA_CLOSE_SOCKET(s);
|
||||
sm->m.sm.s = NULL;
|
||||
} else {
|
||||
s->e = rs->ioa_eng;
|
||||
open_client_connection_session(&(rs->server), &(sm->m.sm));
|
||||
|
||||
@ -1530,6 +1530,7 @@ static void set_socket_ssl(ioa_socket_handle s, SSL *ssl)
|
||||
if(s && (s->ssl != ssl)) {
|
||||
if(s->ssl) {
|
||||
SSL_set_app_data(s->ssl,NULL);
|
||||
SSL_set_info_callback(s->ssl, (ssl_info_callback_t)NULL);
|
||||
}
|
||||
s->ssl = ssl;
|
||||
if(ssl) {
|
||||
@ -1615,16 +1616,16 @@ void detach_socket_net_data(ioa_socket_handle s)
|
||||
if(s->list_ev) {
|
||||
evconnlistener_free(s->list_ev);
|
||||
s->list_ev = NULL;
|
||||
s->acb = NULL;
|
||||
s->acbarg = NULL;
|
||||
}
|
||||
s->acb = NULL;
|
||||
s->acbarg = NULL;
|
||||
if(s->conn_bev) {
|
||||
bufferevent_disable(s->conn_bev,EV_READ|EV_WRITE);
|
||||
bufferevent_free(s->conn_bev);
|
||||
s->conn_bev=NULL;
|
||||
s->conn_arg=NULL;
|
||||
s->conn_cb=NULL;
|
||||
}
|
||||
s->conn_arg=NULL;
|
||||
s->conn_cb=NULL;
|
||||
if(s->bev) {
|
||||
bufferevent_disable(s->bev,EV_READ|EV_WRITE);
|
||||
bufferevent_free(s->bev);
|
||||
|
||||
@ -1543,7 +1543,7 @@ static int handle_turn_refresh(turn_turnserver *server,
|
||||
} else {
|
||||
|
||||
ts_ur_super_session *orig_ss = get_session_from_mobile_map(server, mid);
|
||||
if(!orig_ss) {
|
||||
if(!orig_ss || orig_ss->to_be_closed || ioa_socket_tobeclosed(orig_ss->client_socket)) {
|
||||
*err_code = 404;
|
||||
*reason = (const u08bits *)"Allocation not found";
|
||||
} else if(orig_ss == ss) {
|
||||
@ -1619,7 +1619,9 @@ static int handle_turn_refresh(turn_turnserver *server,
|
||||
} else {
|
||||
|
||||
if(attach_socket_to_session(server, s, orig_ss) < 0) {
|
||||
IOA_CLOSE_SOCKET(s);
|
||||
if(orig_ss->client_socket != s) {
|
||||
IOA_CLOSE_SOCKET(s);
|
||||
}
|
||||
*err_code = 500;
|
||||
} else {
|
||||
|
||||
@ -2017,8 +2019,10 @@ static int tcp_start_connection_to_peer(turn_turnserver *server, ts_ur_super_ses
|
||||
}
|
||||
|
||||
tc->state = TC_STATE_CLIENT_TO_PEER_CONNECTING;
|
||||
IOA_CLOSE_SOCKET(tc->peer_s);
|
||||
tc->peer_s = tcs;
|
||||
if(tc->peer_s != tcs) {
|
||||
IOA_CLOSE_SOCKET(tc->peer_s);
|
||||
tc->peer_s = tcs;
|
||||
}
|
||||
set_ioa_socket_sub_session(tc->peer_s,tc);
|
||||
|
||||
FUNCEND;
|
||||
@ -2086,8 +2090,7 @@ static void tcp_peer_accept_connection(ioa_socket_handle s, void *arg)
|
||||
|
||||
if(register_callback_on_ioa_socket(server->e, s, IOA_EV_READ, tcp_peer_input_handler, tc, 1)<0) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: cannot set TCP peer data input callback\n", __FUNCTION__);
|
||||
close_ioa_socket(s);
|
||||
tc->peer_s = NULL;
|
||||
IOA_CLOSE_SOCKET(tc->peer_s);
|
||||
tc->state = TC_STATE_UNKNOWN;
|
||||
FUNCEND;
|
||||
return;
|
||||
@ -4378,7 +4381,7 @@ static int read_client_connection(turn_turnserver *server,
|
||||
|
||||
FUNCSTART;
|
||||
|
||||
if (!server || !ss || !in_buffer || !(ss->client_socket)) {
|
||||
if (!server || !ss || !in_buffer || !(ss->client_socket) || ss->to_be_closed || ioa_socket_tobeclosed(ss->client_socket)) {
|
||||
FUNCEND;
|
||||
return -1;
|
||||
}
|
||||
@ -4514,7 +4517,7 @@ static int attach_socket_to_session(turn_turnserver* server, ioa_socket_handle s
|
||||
int ret = -1;
|
||||
FUNCSTART;
|
||||
|
||||
if(s && server && ss) {
|
||||
if(s && server && ss && !ioa_socket_tobeclosed(s)) {
|
||||
|
||||
if(ss->client_socket != s) {
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user