working on rfc6062 crash

This commit is contained in:
mom040267 2014-06-03 22:55:24 +00:00
parent 51776875cf
commit f4e49c5dbb
3 changed files with 16 additions and 1 deletions

View File

@ -602,6 +602,17 @@ tcp_connection *get_and_clean_tcp_connection_by_id(ur_map *map, tcp_connection_i
return NULL;
}
tcp_connection *get_tcp_connection_by_id(ur_map *map, tcp_connection_id id)
{
if(map) {
ur_map_value_type t = 0;
if (ur_map_get(map, (ur_map_key_type)id, &t) && t) {
return (tcp_connection*)t;
}
}
return NULL;
}
tcp_connection *get_tcp_connection_by_peer(allocation *a, ioa_addr *peer_addr)
{
if(a && peer_addr) {

View File

@ -217,6 +217,7 @@ ts_ur_session *get_relay_session(allocation *a);
ioa_socket_handle get_relay_socket(allocation *a);
tcp_connection *get_and_clean_tcp_connection_by_id(ur_map *map, tcp_connection_id id);
tcp_connection *get_tcp_connection_by_id(ur_map *map, tcp_connection_id id);
tcp_connection *get_tcp_connection_by_peer(allocation *a, ioa_addr *peer_addr);
int can_accept_tcp_connection_from_peer(allocation *a, ioa_addr *peer_addr, int server_relay);
tcp_connection *create_tcp_connection(u08bits server_id, allocation *a, stun_tid *tid, ioa_addr *peer_addr, int *err_code);

View File

@ -2062,7 +2062,7 @@ int turnserver_accept_tcp_client_data_connection(turn_turnserver *server, tcp_co
if(tcid && tid && s) {
tc = get_and_clean_tcp_connection_by_id(server->tcp_relay_connections, tcid);
tc = get_tcp_connection_by_id(server->tcp_relay_connections, tcid);
ioa_network_buffer_handle nbh = ioa_network_buffer_allocate(server->e);
int resp_constructed = 0;
if(!tc || (tc->state == TC_STATE_READY) || (tc->client_s)) {
@ -2100,6 +2100,9 @@ int turnserver_accept_tcp_client_data_connection(turn_turnserver *server, tcp_co
}
}
if(tc)
get_and_clean_tcp_connection_by_id(server->tcp_relay_connections, tcid);
if(!resp_constructed) {
if(!err_code) {
size_t len = ioa_network_buffer_get_size(nbh);