Browse Source

Log errno on listener socket creation failure.

This may help diagnose bug 4027.
Nick Mathewson 12 years ago
parent
commit
2394c74017
2 changed files with 6 additions and 1 deletions
  1. 4 0
      changes/4027-diagnose
  2. 2 1
      src/or/connection.c

+ 4 - 0
changes/4027-diagnose

@@ -0,0 +1,4 @@
+  o Minor features (diagnostics):
+    - When the system call to create a listener socket fails, log the
+      error message explaining why. This may help diagnose bug 4027.
+

+ 2 - 1
src/or/connection.c

@@ -891,7 +891,8 @@ connection_create_listener(const struct sockaddr *listensockaddr,
                         is_tcp ? SOCK_STREAM : SOCK_DGRAM,
                         is_tcp ? IPPROTO_TCP: IPPROTO_UDP);
     if (!SOCKET_OK(s)) {
-      log_warn(LD_NET,"Socket creation failed.");
+      log_warn(LD_NET,"Socket creation failed: %s",
+               tor_socket_strerror(tor_socket_errno(-1)));
       goto err;
     }