aboutsummaryrefslogtreecommitdiff
path: root/src/nat/nat_stun.c
diff options
context:
space:
mode:
authorBruno Cabral <bcabral@uw.edu>2015-08-28 05:47:13 +0000
committerBruno Cabral <bcabral@uw.edu>2015-08-28 05:47:13 +0000
commitb4fa14499c64140273850569247abda687803053 (patch)
tree63637c01742f5c8bf21fa702ec5f910de70fd907 /src/nat/nat_stun.c
parent6e1bde4fb5a4c4c8a88fa2470b69e95e537f6ab8 (diff)
downloadgnunet-b4fa14499c64140273850569247abda687803053.tar.gz
gnunet-b4fa14499c64140273850569247abda687803053.zip
Fix review,
- Many fixes. - Do not mark test as failed if no connection PATCH 2/3
Diffstat (limited to 'src/nat/nat_stun.c')
-rw-r--r--src/nat/nat_stun.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/nat/nat_stun.c b/src/nat/nat_stun.c
index 57b25e20a..7b41b3387 100644
--- a/src/nat/nat_stun.c
+++ b/src/nat/nat_stun.c
@@ -82,7 +82,7 @@ struct GNUNET_NAT_STUN_Handle {
82 /** 82 /**
83 * Function to call when a error occours 83 * Function to call when a error occours
84 */ 84 */
85 GNUNET_NAT_stun_RequestCallback cb; 85 GNUNET_NAT_STUN_ErrorCallback cb;
86 86
87 /** 87 /**
88 * Closure for @e cb. 88 * Closure for @e cb.
@@ -441,7 +441,10 @@ GNUNET_NAT_stun_handle_packet(const void *data, size_t len, struct sockaddr_in *
441static void 441static void
442clean(struct GNUNET_NAT_STUN_Handle * handle) 442clean(struct GNUNET_NAT_STUN_Handle * handle)
443{ 443{
444 if(handle->stun_server)
445 {
444 GNUNET_free(handle->stun_server); 446 GNUNET_free(handle->stun_server);
447 }
445 GNUNET_free(handle); 448 GNUNET_free(handle);
446 449
447} 450}
@@ -485,7 +488,7 @@ stun_dns_callback (void *cls,
485 488
486 if( GNUNET_NO == request->dns_success){ 489 if( GNUNET_NO == request->dns_success){
487 LOG (GNUNET_ERROR_TYPE_INFO, "Error resolving host %s\n", request->stun_server); 490 LOG (GNUNET_ERROR_TYPE_INFO, "Error resolving host %s\n", request->stun_server);
488 request->cb(request->cb_cls, GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR); 491 request->cb(request->cb_cls, GNUNET_NAT_ERROR_NOT_ONLINE);
489 clean(request); 492 clean(request);
490 493
491 } 494 }
@@ -536,11 +539,14 @@ stun_dns_callback (void *cls,
536 * @param server, the address of the stun server 539 * @param server, the address of the stun server
537 * @param port, port of the stun server 540 * @param port, port of the stun server
538 * @param sock the socket used to send the request 541 * @param sock the socket used to send the request
542 * @param cb, callback in case of error
539 * @return #GNUNET_OK success, #GNUNET_NO on error. 543 * @return #GNUNET_OK success, #GNUNET_NO on error.
540 */ 544 */
541int 545int
542GNUNET_NAT_stun_make_request(char * server, int port, 546GNUNET_NAT_stun_make_request(char * server,
543 struct GNUNET_NETWORK_Handle * sock,GNUNET_NAT_stun_RequestCallback cb, 547 int port,
548 struct GNUNET_NETWORK_Handle * sock,
549 GNUNET_NAT_STUN_ErrorCallback cb,
544 void *cb_cls) 550 void *cb_cls)
545{ 551{
546 552