diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-04-20 14:27:30 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-04-20 14:27:30 +0000 |
commit | c0166a21606b03ce5e4250af446b88f1e2478682 (patch) | |
tree | 621d95679383a1e7da3085a458f6294f61cd6a4b /src/transport/plugin_transport_unix.c | |
parent | eec473b088fc4ce9f47e01258be0dc8cb1cd0659 (diff) | |
download | gnunet-c0166a21606b03ce5e4250af446b88f1e2478682.tar.gz gnunet-c0166a21606b03ce5e4250af446b88f1e2478682.zip |
fix
Diffstat (limited to 'src/transport/plugin_transport_unix.c')
-rw-r--r-- | src/transport/plugin_transport_unix.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c index d9b666f77..f4a69d84e 100644 --- a/src/transport/plugin_transport_unix.c +++ b/src/transport/plugin_transport_unix.c | |||
@@ -897,10 +897,8 @@ static int | |||
897 | unix_transport_server_start (void *cls) | 897 | unix_transport_server_start (void *cls) |
898 | { | 898 | { |
899 | struct Plugin *plugin = cls; | 899 | struct Plugin *plugin = cls; |
900 | |||
901 | struct sockaddr *serverAddr; | 900 | struct sockaddr *serverAddr; |
902 | socklen_t addrlen; | 901 | socklen_t addrlen; |
903 | int sockets_created; | ||
904 | struct sockaddr_un un; | 902 | struct sockaddr_un un; |
905 | size_t slen; | 903 | size_t slen; |
906 | 904 | ||
@@ -914,7 +912,6 @@ unix_transport_server_start (void *cls) | |||
914 | slen += sizeof (sa_family_t); | 912 | slen += sizeof (sa_family_t); |
915 | serverAddr = (struct sockaddr*) &un; | 913 | serverAddr = (struct sockaddr*) &un; |
916 | addrlen = slen; | 914 | addrlen = slen; |
917 | sockets_created = 0; | ||
918 | #if LINUX | 915 | #if LINUX |
919 | un.sun_path[0] = '\0'; | 916 | un.sun_path[0] = '\0'; |
920 | #endif | 917 | #endif |
@@ -922,24 +919,23 @@ unix_transport_server_start (void *cls) | |||
922 | plugin->unix_sock.desc = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_DGRAM, 0); | 919 | plugin->unix_sock.desc = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_DGRAM, 0); |
923 | if (NULL == plugin->unix_sock.desc) | 920 | if (NULL == plugin->unix_sock.desc) |
924 | { | 921 | { |
925 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "socket"); | 922 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket"); |
923 | return GNUNET_SYSERR; | ||
926 | } | 924 | } |
927 | else | 925 | if (GNUNET_NETWORK_socket_bind (plugin->unix_sock.desc, serverAddr, addrlen) != |
926 | GNUNET_OK) | ||
928 | { | 927 | { |
929 | if (GNUNET_NETWORK_socket_bind (plugin->unix_sock.desc, serverAddr, addrlen) != | 928 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind"); |
930 | GNUNET_OK) | 929 | GNUNET_NETWORK_socket_close (plugin->unix_sock.desc); |
931 | { | 930 | plugin->unix_sock.desc = NULL; |
931 | return GNUNET_SYSERR; | ||
932 | } | ||
932 | #if DEBUG_UNIX | 933 | #if DEBUG_UNIX |
933 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 934 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, |
934 | "UNIX Binding failed!\n"); | 935 | "unix", |
936 | "Bound to `%s'\n", | ||
937 | &un.sun_path[0]); | ||
935 | #endif | 938 | #endif |
936 | } | ||
937 | else | ||
938 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Bound to `%s'\n", &un.sun_path[0]); | ||
939 | if (plugin->unix_sock.desc != NULL) | ||
940 | sockets_created++; | ||
941 | } | ||
942 | |||
943 | plugin->rs = GNUNET_NETWORK_fdset_create (); | 939 | plugin->rs = GNUNET_NETWORK_fdset_create (); |
944 | GNUNET_NETWORK_fdset_zero (plugin->rs); | 940 | GNUNET_NETWORK_fdset_zero (plugin->rs); |
945 | GNUNET_NETWORK_fdset_set (plugin->rs, | 941 | GNUNET_NETWORK_fdset_set (plugin->rs, |
@@ -950,7 +946,7 @@ unix_transport_server_start (void *cls) | |||
950 | GNUNET_SCHEDULER_NO_TASK, | 946 | GNUNET_SCHEDULER_NO_TASK, |
951 | GNUNET_TIME_UNIT_FOREVER_REL, plugin->rs, | 947 | GNUNET_TIME_UNIT_FOREVER_REL, plugin->rs, |
952 | NULL, &unix_plugin_select, plugin); | 948 | NULL, &unix_plugin_select, plugin); |
953 | return sockets_created; | 949 | return 1; |
954 | } | 950 | } |
955 | 951 | ||
956 | 952 | ||