diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-10-11 13:03:51 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-10-11 13:03:51 +0000 |
commit | 96219e61dcde38486e7f5a0c2d4f6927c47e9296 (patch) | |
tree | 82d06e217a01368e6ee8bfd12e686cb75265b35b /src/nat | |
parent | fc10d04ba1a58540fbb55b3cabffbf64d51ea989 (diff) | |
download | gnunet-96219e61dcde38486e7f5a0c2d4f6927c47e9296.tar.gz gnunet-96219e61dcde38486e7f5a0c2d4f6927c47e9296.zip |
fixing segv
Diffstat (limited to 'src/nat')
-rw-r--r-- | src/nat/nat.c | 12 | ||||
-rw-r--r-- | src/nat/upnp-commands.c | 9 | ||||
-rw-r--r-- | src/nat/upnp-discover.c | 3 |
3 files changed, 13 insertions, 11 deletions
diff --git a/src/nat/nat.c b/src/nat/nat.c index 5159e0903..74d08bd6f 100644 --- a/src/nat/nat.c +++ b/src/nat/nat.c | |||
@@ -333,10 +333,9 @@ nat_pulse (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
333 | struct GNUNET_NAT_Handle *h = cls; | 333 | struct GNUNET_NAT_Handle *h = cls; |
334 | 334 | ||
335 | /* Stop if we're already waiting for an action to complete */ | 335 | /* Stop if we're already waiting for an action to complete */ |
336 | h->pulse_timer = GNUNET_SCHEDULER_NO_TASK; | ||
336 | if (h->processing) | 337 | if (h->processing) |
337 | return; | 338 | return; |
338 | |||
339 | h->pulse_timer = GNUNET_SCHEDULER_NO_TASK; | ||
340 | h->old_status = get_traversal_status (h); | 339 | h->old_status = get_traversal_status (h); |
341 | 340 | ||
342 | /* Only update the protocol that has been successful until now */ | 341 | /* Only update the protocol that has been successful until now */ |
@@ -361,7 +360,7 @@ nat_pulse (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
361 | 360 | ||
362 | GNUNET_NAT_UPNP_pulse (h->upnp, h->is_enabled, GNUNET_YES); | 361 | GNUNET_NAT_UPNP_pulse (h->upnp, h->is_enabled, GNUNET_YES); |
363 | #if 0 | 362 | #if 0 |
364 | GNUNET_NAT_NATPMP_pulse (h->natpmp, h->is_enabled, natpmp_pulse_cb, h); | 363 | GNUNET_NAT_NATPMP_pulse (h->natpmp, h->is_enabled, &natpmp_pulse_cb, h); |
365 | #endif | 364 | #endif |
366 | } | 365 | } |
367 | } | 366 | } |
@@ -417,11 +416,11 @@ GNUNET_NAT_register (struct GNUNET_SCHEDULER_Handle | |||
417 | h->callback_cls = callback_cls; | 416 | h->callback_cls = callback_cls; |
418 | h->upnp = | 417 | h->upnp = |
419 | GNUNET_NAT_UPNP_init (h->sched, h->local_addr, addrlen, h->public_port, | 418 | GNUNET_NAT_UPNP_init (h->sched, h->local_addr, addrlen, h->public_port, |
420 | upnp_pulse_cb, h); | 419 | &upnp_pulse_cb, h); |
421 | #if 0 | 420 | #if 0 |
422 | h->natpmp = | 421 | h->natpmp = |
423 | GNUNET_NAT_NATPMP_init (h->sched, h->local_addr, addrlen, h->public_port, | 422 | GNUNET_NAT_NATPMP_init (h->sched, h->local_addr, addrlen, h->public_port, |
424 | natpmp_pulse_cb, h); | 423 | &natpmp_pulse_cb, h); |
425 | #endif | 424 | #endif |
426 | h->pulse_timer = GNUNET_SCHEDULER_add_delayed (sched, | 425 | h->pulse_timer = GNUNET_SCHEDULER_add_delayed (sched, |
427 | GNUNET_TIME_UNIT_SECONDS, | 426 | GNUNET_TIME_UNIT_SECONDS, |
@@ -447,7 +446,8 @@ GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *h) | |||
447 | GNUNET_NAT_NATPMP_close (h->natpmp); | 446 | GNUNET_NAT_NATPMP_close (h->natpmp); |
448 | #endif | 447 | #endif |
449 | 448 | ||
450 | GNUNET_SCHEDULER_cancel (h->sched, h->pulse_timer); | 449 | if (GNUNET_SCHEDULER_NO_TASK != h->pulse_timer) |
450 | GNUNET_SCHEDULER_cancel (h->sched, h->pulse_timer); | ||
451 | 451 | ||
452 | GNUNET_free_non_null (h->local_addr); | 452 | GNUNET_free_non_null (h->local_addr); |
453 | GNUNET_free_non_null (h->ext_addr); | 453 | GNUNET_free_non_null (h->ext_addr); |
diff --git a/src/nat/upnp-commands.c b/src/nat/upnp-commands.c index ddc5d9473..09b004968 100644 --- a/src/nat/upnp-commands.c +++ b/src/nat/upnp-commands.c | |||
@@ -256,7 +256,7 @@ UPNP_command_receiver (void *data, | |||
256 | 256 | ||
257 | GNUNET_CONNECTION_destroy (cls->s, GNUNET_NO); | 257 | GNUNET_CONNECTION_destroy (cls->s, GNUNET_NO); |
258 | 258 | ||
259 | (*cls->caller_cb) (cls->buffer, cls->buf_size, cls->caller_cls); | 259 | cls->caller_cb (cls->buffer, cls->buf_size, cls->caller_cls); |
260 | 260 | ||
261 | GNUNET_free (cls->content); | 261 | GNUNET_free (cls->content); |
262 | GNUNET_free (cls); | 262 | GNUNET_free (cls); |
@@ -415,7 +415,7 @@ UPNP_command_ (struct GNUNET_SCHEDULER_Handle *sched, | |||
415 | if (soap_body + sizeof (soap_body) <= p + 100) | 415 | if (soap_body + sizeof (soap_body) <= p + 100) |
416 | { | 416 | { |
417 | GNUNET_assert (GNUNET_NO); | 417 | GNUNET_assert (GNUNET_NO); |
418 | (*caller_cb) (buffer, 0, caller_cls); | 418 | caller_cb (buffer, 0, caller_cls); |
419 | return; | 419 | return; |
420 | } | 420 | } |
421 | *(p++) = '<'; | 421 | *(p++) = '<'; |
@@ -453,6 +453,7 @@ UPNP_command_ (struct GNUNET_SCHEDULER_Handle *sched, | |||
453 | { | 453 | { |
454 | GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, "UPnP", | 454 | GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, "UPnP", |
455 | "Invalid URL passed to UPNP_command(): %s\n", url); | 455 | "Invalid URL passed to UPNP_command(): %s\n", url); |
456 | caller_cb (buffer, 0, caller_cls); | ||
456 | return; | 457 | return; |
457 | } | 458 | } |
458 | 459 | ||
@@ -490,7 +491,7 @@ UPNP_command_ (struct GNUNET_SCHEDULER_Handle *sched, | |||
490 | GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, _("%s failed at %s:%d\n"), | 491 | GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, _("%s failed at %s:%d\n"), |
491 | "UPnP", "inet_pton", __FILE__, __LINE__); | 492 | "UPnP", "inet_pton", __FILE__, __LINE__); |
492 | 493 | ||
493 | (*caller_cb) (buffer, 0, caller_cls); | 494 | caller_cb (buffer, 0, caller_cls); |
494 | return; | 495 | return; |
495 | } | 496 | } |
496 | 497 | ||
@@ -541,7 +542,7 @@ UPNP_command_ (struct GNUNET_SCHEDULER_Handle *sched, | |||
541 | __LINE__); | 542 | __LINE__); |
542 | #endif | 543 | #endif |
543 | 544 | ||
544 | (*caller_cb) (buffer, 0, caller_cls); | 545 | caller_cb (buffer, 0, caller_cls); |
545 | 546 | ||
546 | GNUNET_free (content_buf); | 547 | GNUNET_free (content_buf); |
547 | GNUNET_free (cls); | 548 | GNUNET_free (cls); |
diff --git a/src/nat/upnp-discover.c b/src/nat/upnp-discover.c index 715f2fcee..5c64d161d 100644 --- a/src/nat/upnp-discover.c +++ b/src/nat/upnp-discover.c | |||
@@ -955,7 +955,8 @@ discover_recv (void *data, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
955 | &addrlen); | 955 | &addrlen); |
956 | if (received == GNUNET_SYSERR) | 956 | if (received == GNUNET_SYSERR) |
957 | { | 957 | { |
958 | PRINT_SOCKET_ERROR ("GNUNET_NETWORK_socket_recvfrom"); | 958 | if (errno != EAGAIN) |
959 | PRINT_SOCKET_ERROR ("GNUNET_NETWORK_socket_recvfrom"); | ||
959 | } | 960 | } |
960 | #if DEBUG_UPNP | 961 | #if DEBUG_UPNP |
961 | else | 962 | else |