fix shutdown, fix size calculation
authorChristian Grothoff <christian@grothoff.org>
Fri, 16 Dec 2016 11:10:19 +0000 (12:10 +0100)
committerChristian Grothoff <christian@grothoff.org>
Fri, 16 Dec 2016 11:10:19 +0000 (12:10 +0100)
src/nat/gnunet-nat.c
src/nat/gnunet-service-nat.c

index ff326fe0c26751142089cf1462cd6950c08d5f6d..07e65141bb0eebd7d501cf3e4a183ceef8dc1a18 100644 (file)
@@ -401,6 +401,9 @@ run (void *cls,
   if (use_udp)
     proto = IPPROTO_UDP;
 
+  GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
+                                NULL);
+
   if (do_auto)
   {
     ah = GNUNET_NAT_autoconfig_start (c,
@@ -501,9 +504,6 @@ run (void *cls,
                              NULL);
   }
 
-  GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
-                                NULL);
-
   if (NULL != remote_addr)
   {
     int ret;
index 0da85488398607c78b037876973039f55d361922..4ad6c8d2c5d1e6e5a10463345034e3e5fff7a105 100644 (file)
@@ -837,7 +837,7 @@ handle_autoconfig_request (void *cls,
                           const struct GNUNET_NAT_AutoconfigRequestMessage *message)
 {
   struct ClientHandle *ch = cls;
-  size_t left = ntohs (message->header.size);
+  size_t left = ntohs (message->header.size) - sizeof (*message);
   struct GNUNET_CONFIGURATION_Handle *c;
 
   c = GNUNET_CONFIGURATION_create ();