浏览代码

r14722@catbus: nickm | 2007-08-20 10:54:29 -0400
Add debugging warning to not abort in the case of bug 483. This is probably not an actual error case, so we should figure out what is really causing it and do something more sensible.


svn:r11215

Nick Mathewson 18 年之前
父节点
当前提交
113367bc01
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      src/or/connection.c

+ 9 - 1
src/or/connection.c

@@ -931,7 +931,15 @@ connection_handle_listener_read(connection_t *conn, int new_type)
   if (options->ConstrainedSockets)
     set_constrained_socket_buffers(news, (int)options->ConstrainedSockSize);
 
-  tor_assert(((struct sockaddr*)addrbuf)->sa_family == conn->socket_family);
+  if (((struct sockaddr*)addrbuf)->sa_family != conn->socket_family) {
+    log_warn(LD_BUG, "A listener connection returned a socket with a "
+             "mismatched family. %s for addr_family %d gave us a socket "
+             "with address family %d.", conn_type_to_string(conn->type),
+             (int)conn->socket_family,
+             (int)((struct sockaddr*)addrbuf)->sa_family);
+    tor_close_socket(news);
+    return 0;
+  }
 
   if (conn->socket_family == AF_INET) {
     if (check_sockaddr_in((struct sockaddr*)addrbuf, remotelen, LOG_INFO)<0) {