gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r13256 - gnunet/src/nat


From: gnunet
Subject: [GNUnet-SVN] r13256 - gnunet/src/nat
Date: Mon, 11 Oct 2010 15:03:51 +0200

Author: grothoff
Date: 2010-10-11 15:03:51 +0200 (Mon, 11 Oct 2010)
New Revision: 13256

Modified:
   gnunet/src/nat/nat.c
   gnunet/src/nat/upnp-commands.c
   gnunet/src/nat/upnp-discover.c
Log:
fixing segv

Modified: gnunet/src/nat/nat.c
===================================================================
--- gnunet/src/nat/nat.c        2010-10-11 12:46:39 UTC (rev 13255)
+++ gnunet/src/nat/nat.c        2010-10-11 13:03:51 UTC (rev 13256)
@@ -333,10 +333,9 @@
   struct GNUNET_NAT_Handle *h = cls;
 
   /* Stop if we're already waiting for an action to complete */
+  h->pulse_timer = GNUNET_SCHEDULER_NO_TASK;
   if (h->processing)
     return;
-
-  h->pulse_timer = GNUNET_SCHEDULER_NO_TASK;
   h->old_status = get_traversal_status (h);
 
   /* Only update the protocol that has been successful until now */
@@ -361,7 +360,7 @@
 
       GNUNET_NAT_UPNP_pulse (h->upnp, h->is_enabled, GNUNET_YES);
 #if 0
-      GNUNET_NAT_NATPMP_pulse (h->natpmp, h->is_enabled, natpmp_pulse_cb, h);
+      GNUNET_NAT_NATPMP_pulse (h->natpmp, h->is_enabled, &natpmp_pulse_cb, h);
 #endif
     }
 }
@@ -417,11 +416,11 @@
   h->callback_cls = callback_cls;
   h->upnp =
     GNUNET_NAT_UPNP_init (h->sched, h->local_addr, addrlen, h->public_port,
-                          upnp_pulse_cb, h);
+                          &upnp_pulse_cb, h);
 #if 0
   h->natpmp =
     GNUNET_NAT_NATPMP_init (h->sched, h->local_addr, addrlen, h->public_port,
-                            natpmp_pulse_cb, h);
+                            &natpmp_pulse_cb, h);
 #endif
   h->pulse_timer = GNUNET_SCHEDULER_add_delayed (sched,
                                                  GNUNET_TIME_UNIT_SECONDS,
@@ -447,7 +446,8 @@
   GNUNET_NAT_NATPMP_close (h->natpmp);
 #endif
 
-  GNUNET_SCHEDULER_cancel (h->sched, h->pulse_timer);
+  if (GNUNET_SCHEDULER_NO_TASK != h->pulse_timer)
+    GNUNET_SCHEDULER_cancel (h->sched, h->pulse_timer);
 
   GNUNET_free_non_null (h->local_addr);
   GNUNET_free_non_null (h->ext_addr);

Modified: gnunet/src/nat/upnp-commands.c
===================================================================
--- gnunet/src/nat/upnp-commands.c      2010-10-11 12:46:39 UTC (rev 13255)
+++ gnunet/src/nat/upnp-commands.c      2010-10-11 13:03:51 UTC (rev 13256)
@@ -256,7 +256,7 @@
 
   GNUNET_CONNECTION_destroy (cls->s, GNUNET_NO);
 
-  (*cls->caller_cb) (cls->buffer, cls->buf_size, cls->caller_cls);
+  cls->caller_cb (cls->buffer, cls->buf_size, cls->caller_cls);
 
   GNUNET_free (cls->content);
   GNUNET_free (cls);
@@ -415,7 +415,7 @@
           if (soap_body + sizeof (soap_body) <= p + 100)
             {
               GNUNET_assert (GNUNET_NO);
-              (*caller_cb) (buffer, 0, caller_cls);
+              caller_cb (buffer, 0, caller_cls);
               return;
             }
           *(p++) = '<';
@@ -453,6 +453,7 @@
     {
       GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, "UPnP",
                        "Invalid URL passed to UPNP_command(): %s\n", url);
+      caller_cb (buffer, 0, caller_cls);
       return;
     }
 
@@ -490,7 +491,7 @@
       GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, _("%s failed at %s:%d\n"),
                        "UPnP", "inet_pton", __FILE__, __LINE__);
 
-      (*caller_cb) (buffer, 0, caller_cls);
+      caller_cb (buffer, 0, caller_cls);
       return;
     }
 
@@ -541,7 +542,7 @@
                        __LINE__);
 #endif
 
-      (*caller_cb) (buffer, 0, caller_cls);
+      caller_cb (buffer, 0, caller_cls);
 
       GNUNET_free (content_buf);
       GNUNET_free (cls);

Modified: gnunet/src/nat/upnp-discover.c
===================================================================
--- gnunet/src/nat/upnp-discover.c      2010-10-11 12:46:39 UTC (rev 13255)
+++ gnunet/src/nat/upnp-discover.c      2010-10-11 13:03:51 UTC (rev 13256)
@@ -955,7 +955,8 @@
                                     &addrlen);
   if (received == GNUNET_SYSERR)
     {
-      PRINT_SOCKET_ERROR ("GNUNET_NETWORK_socket_recvfrom");
+      if (errno != EAGAIN)
+       PRINT_SOCKET_ERROR ("GNUNET_NETWORK_socket_recvfrom");
     }
 #if DEBUG_UPNP
   else




reply via email to

[Prev in Thread] Current Thread [Next in Thread]