gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r15054 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r15054 - gnunet/src/transport
Date: Wed, 20 Apr 2011 16:27:30 +0200

Author: grothoff
Date: 2011-04-20 16:27:30 +0200 (Wed, 20 Apr 2011)
New Revision: 15054

Modified:
   gnunet/src/transport/plugin_transport_unix.c
Log:
fix

Modified: gnunet/src/transport/plugin_transport_unix.c
===================================================================
--- gnunet/src/transport/plugin_transport_unix.c        2011-04-20 14:25:08 UTC 
(rev 15053)
+++ gnunet/src/transport/plugin_transport_unix.c        2011-04-20 14:27:30 UTC 
(rev 15054)
@@ -897,10 +897,8 @@
 unix_transport_server_start (void *cls)
 {
   struct Plugin *plugin = cls;
-
   struct sockaddr *serverAddr;
   socklen_t addrlen;
-  int sockets_created;
   struct sockaddr_un un;
   size_t slen;
 
@@ -914,7 +912,6 @@
   slen += sizeof (sa_family_t);
   serverAddr = (struct sockaddr*) &un;
   addrlen = slen;
-  sockets_created = 0;
 #if LINUX
   un.sun_path[0] = '\0';
 #endif
@@ -922,24 +919,23 @@
   plugin->unix_sock.desc = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_DGRAM, 
0);
   if (NULL == plugin->unix_sock.desc)
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "socket");
+      GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket");
+      return GNUNET_SYSERR;
     }
-  else
+  if (GNUNET_NETWORK_socket_bind (plugin->unix_sock.desc, serverAddr, addrlen) 
!=
+      GNUNET_OK)
     {
-      if (GNUNET_NETWORK_socket_bind (plugin->unix_sock.desc, serverAddr, 
addrlen) !=
-            GNUNET_OK)
-       {
+      GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind");
+      GNUNET_NETWORK_socket_close (plugin->unix_sock.desc);
+      plugin->unix_sock.desc = NULL;
+      return GNUNET_SYSERR;
+    }
 #if DEBUG_UNIX
-         GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                          "UNIX Binding failed!\n");
+  GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 
+                  "unix",
+                  "Bound to `%s'\n",
+                  &un.sun_path[0]);
 #endif
-       }
-      else
-        GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Bound to `%s'\n", 
&un.sun_path[0]);
-      if (plugin->unix_sock.desc != NULL)
-        sockets_created++;
-    }
-
   plugin->rs = GNUNET_NETWORK_fdset_create ();
   GNUNET_NETWORK_fdset_zero (plugin->rs);
   GNUNET_NETWORK_fdset_set (plugin->rs,
@@ -950,7 +946,7 @@
                                  GNUNET_SCHEDULER_NO_TASK,
                                  GNUNET_TIME_UNIT_FOREVER_REL, plugin->rs,
                                  NULL, &unix_plugin_select, plugin);
-  return sockets_created;
+  return 1;
 }
 
 




reply via email to

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