Commit 0df3c0ce authored by Martti Mela's avatar Martti Mela

minor stun changes to tport.c

darcs-hash:20051216123529-1b897-a979e5269ddd57d4f8aa19bf175e00b63c5fd556.gz
parent 46e92b39
......@@ -798,7 +798,7 @@ int stun_connect_start(stun_handle_t *se)
}
else {
SU_DEBUG_3(("No message integrity enabled.\n"));
return -1;
return errno = EFAULT, -1;
}
/* open tcp connection to server */
......
......@@ -371,7 +371,7 @@ struct tport_master {
#if HAVE_SOFIA_STUN
char *stun_server;
stun_socket_t *stun_socket;
stun_engine_t *stun;
stun_handle_t *stun;
#endif
} mr_nat[1];
};
......@@ -6843,7 +6843,8 @@ void thrp_udp_send_report(su_root_magic_t *magic,
#if HAVE_SOFIA_STUN
void tport_stun_cb(tport_master_t *tport,
stun_engine_t *se,
stun_handle_t *se,
stun_socket_t *ss,
stun_states_t event)
{
......@@ -6878,7 +6879,7 @@ tport_nat_initialize_nat_traversal(tport_master_t *mr,
strcasecmp(tpn->tpn_proto, stun_transports[i]) == 0)) {
SU_DEBUG_5(("%s(%p) starting STUN engine\n", __func__, mr));
nat->stun = stun_engine_tcreate(mr,
nat->stun = stun_handle_tcreate(mr,
mr->mr_root,
tport_stun_cb,
TAG_NEXT(tags));
......@@ -6886,6 +6887,11 @@ tport_nat_initialize_nat_traversal(tport_master_t *mr,
if (!nat->stun)
return NULL;
if (stun_connect_start(nat->stun) < 0 && errno != EFAULT) {
stun_handle_destroy(nat->stun), nat->stun = NULL;
break;
}
nat->try_stun = 1;
/* We support only UDP if STUN is used */
*return_transports = stun_transports;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment