diff options
author | Bruno Cabral <bcabral@uw.edu> | 2015-08-21 04:15:24 +0000 |
---|---|---|
committer | Bruno Cabral <bcabral@uw.edu> | 2015-08-21 04:15:24 +0000 |
commit | ecc90530eb2b3f4d0d5037d8d8b69722dda2a2cb (patch) | |
tree | e43497b563f2d7ee7856fb8f2f57bb8f2598b371 /src/nat/test_stun.c | |
parent | 946e39d3696847334b5316902c1eeb84d4c34cb0 (diff) | |
download | gnunet-ecc90530eb2b3f4d0d5037d8d8b69722dda2a2cb.tar.gz gnunet-ecc90530eb2b3f4d0d5037d8d8b69722dda2a2cb.zip |
Fix crashes and memory leaks.
Diffstat (limited to 'src/nat/test_stun.c')
-rw-r--r-- | src/nat/test_stun.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/nat/test_stun.c b/src/nat/test_stun.c index e75d55bd0..3988dc053 100644 --- a/src/nat/test_stun.c +++ b/src/nat/test_stun.c | |||
@@ -51,8 +51,8 @@ | |||
51 | static unsigned long port = 7895; | 51 | static unsigned long port = 7895; |
52 | static int ret = 1; | 52 | static int ret = 1; |
53 | 53 | ||
54 | static char *stun_server = "stun2.l.google.com"; | 54 | static char *stun_server = "stun.ekiga.net"; |
55 | static int stun_port = 19302; | 55 | static int stun_port = 3478; |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * The listen socket of the service for IPv4 | 58 | * The listen socket of the service for IPv4 |
@@ -71,7 +71,7 @@ static struct GNUNET_SCHEDULER_Task * ltask4; | |||
71 | static void | 71 | static void |
72 | print_answer(struct sockaddr_in* answer) | 72 | print_answer(struct sockaddr_in* answer) |
73 | { | 73 | { |
74 | printf("External IP is: %s , with port %d\n", inet_ntoa(answer->sin_addr), ntohs(answer->sin_port)); | 74 | GNUNET_log (GNUNET_ERROR_TYPE_INFO,"External IP is: %s , with port %d\n", inet_ntoa(answer->sin_addr), ntohs(answer->sin_port)); |
75 | } | 75 | } |
76 | 76 | ||
77 | 77 | ||
@@ -91,9 +91,6 @@ do_udp_read (void *cls, | |||
91 | ssize_t rlen; | 91 | ssize_t rlen; |
92 | struct sockaddr_in answer; | 92 | struct sockaddr_in answer; |
93 | 93 | ||
94 | printf("UDP READ\n"); | ||
95 | |||
96 | |||
97 | if ((0 != (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) && | 94 | if ((0 != (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) && |
98 | (GNUNET_NETWORK_fdset_isset (tc->read_ready, | 95 | (GNUNET_NETWORK_fdset_isset (tc->read_ready, |
99 | lsock4))) | 96 | lsock4))) |
@@ -161,7 +158,6 @@ stop () | |||
161 | { | 158 | { |
162 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stopping NAT and quitting...\n"); | 159 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stopping NAT and quitting...\n"); |
163 | 160 | ||
164 | printf("Stopped !!\n"); | ||
165 | //Clean task | 161 | //Clean task |
166 | if(NULL != ltask4) | 162 | if(NULL != ltask4) |
167 | GNUNET_SCHEDULER_cancel (ltask4); | 163 | GNUNET_SCHEDULER_cancel (ltask4); |
@@ -178,7 +174,6 @@ enum GNUNET_NAT_StatusCode result) | |||
178 | { | 174 | { |
179 | ret = result; | 175 | ret = result; |
180 | stop(); | 176 | stop(); |
181 | printf("Called back\n"); | ||
182 | }; | 177 | }; |
183 | 178 | ||
184 | 179 | ||
@@ -211,9 +206,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
211 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 206 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
212 | "Service listens on port %u\n", | 207 | "Service listens on port %u\n", |
213 | port); | 208 | port); |
214 | printf("Start main event\n"); | ||
215 | GNUNET_NAT_stun_make_request(stun_server, stun_port, lsock4, &request_callback, NULL); | 209 | GNUNET_NAT_stun_make_request(stun_server, stun_port, lsock4, &request_callback, NULL); |
216 | printf("Made the requeest\n"); | ||
217 | 210 | ||
218 | //GNUNET_SCHEDULER_add_delayed (TIMEOUT, &stop, NULL); | 211 | //GNUNET_SCHEDULER_add_delayed (TIMEOUT, &stop, NULL); |
219 | 212 | ||