set type correctly in nat auto test
authorChristian Grothoff <christian@grothoff.org>
Thu, 16 Feb 2017 14:08:42 +0000 (15:08 +0100)
committerChristian Grothoff <christian@grothoff.org>
Thu, 16 Feb 2017 14:08:42 +0000 (15:08 +0100)
src/nat-auto/nat_auto_api.c
src/nat-auto/nat_auto_api_test.c

index a5b41ac491e2c86343abc35a2ec529cdc5f29439..6660239c3f41d62df521f9691936b794e41faacf 100644 (file)
@@ -42,7 +42,7 @@ struct GNUNET_NAT_AUTO_AutoHandle
    * Configuration we use.
    */
   const struct GNUNET_CONFIGURATION_Handle *cfg;
-  
+
   /**
    * Message queue for communicating with the NAT service.
    */
@@ -206,8 +206,8 @@ ah_error_handler (void *cls,
  */
 struct GNUNET_NAT_AUTO_AutoHandle *
 GNUNET_NAT_AUTO_autoconfig_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                            GNUNET_NAT_AUTO_AutoResultCallback cb,
-                            void *cb_cls)
+                                  GNUNET_NAT_AUTO_AutoResultCallback cb,
+                                  void *cb_cls)
 {
   struct GNUNET_NAT_AUTO_AutoHandle *ah = GNUNET_new (struct GNUNET_NAT_AUTO_AutoHandle);
   struct GNUNET_MQ_MessageHandler handlers[] = {
index fb2bcd6798f318a7ae387da6afd0b7359522d375..dda0a3b41ce32349a8406c6195adc57bd8fa4a2a 100644 (file)
@@ -28,7 +28,7 @@
 #include "gnunet_nat_auto_service.h"
 #include "nat-auto.h"
 
-#define LOG(kind,...) GNUNET_log_from (kind, "nat", __VA_ARGS__)
+#define LOG(kind,...) GNUNET_log_from (kind, "nat-auto", __VA_ARGS__)
 
 #define NAT_SERVER_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
 
@@ -508,19 +508,21 @@ GNUNET_NAT_AUTO_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
   {
     nh->lsock
       = GNUNET_NETWORK_socket_create (AF_INET,
-                                      proto,
-                                      0);
+                                      (IPPROTO_UDP == proto)
+                                      ? SOCK_DGRAM
+                                      : SOCK_STREAM,
+                                      proto);
     if ( (NULL == nh->lsock) ||
          (GNUNET_OK !=
           GNUNET_NETWORK_socket_bind (nh->lsock,
                                       (const struct sockaddr *) &sa,
                                       sizeof (sa))))
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _("Failed to create listen socket bound to `%s' for NAT test: %s\n"),
-                  GNUNET_a2s ((const struct sockaddr *) &sa,
-                              sizeof (sa)),
-                  STRERROR (errno));
+      LOG (GNUNET_ERROR_TYPE_ERROR,
+           _("Failed to create socket bound to `%s' for NAT test: %s\n"),
+           GNUNET_a2s ((const struct sockaddr *) &sa,
+                       sizeof (sa)),
+           STRERROR (errno));
       if (NULL != nh->lsock)
       {
         GNUNET_NETWORK_socket_close (nh->lsock);