浏览代码

We got an obscure report of an assert error on a windows Tor server with
connection_add being called with socket = -1. The only places I can see
where that happen would be if our tor_socketpair succeeds but it hands
back negative values for some of its file descriptors. Perhaps this will
produce more useful assert errors next time.


svn:r6550

Roger Dingledine 19 年之前
父节点
当前提交
5c57348acd
共有 3 个文件被更改,包括 9 次插入0 次删除
  1. 3 0
      src/or/connection_edge.c
  2. 3 0
      src/or/cpuworker.c
  3. 3 0
      src/or/dns.c

+ 3 - 0
src/or/connection_edge.c

@@ -1398,6 +1398,9 @@ connection_ap_make_bridge(char *address, uint16_t port)
     return -1;
     return -1;
   }
   }
 
 
+  tor_assert(fd[0] >= 0);
+  tor_assert(fd[1] >= 0);
+
   set_socket_nonblocking(fd[0]);
   set_socket_nonblocking(fd[0]);
   set_socket_nonblocking(fd[1]);
   set_socket_nonblocking(fd[1]);
 
 

+ 3 - 0
src/or/cpuworker.c

@@ -329,6 +329,9 @@ spawn_cpuworker(void)
     return -1;
     return -1;
   }
   }
 
 
+  tor_assert(fdarray[0] >= 0);
+  tor_assert(fdarray[1] >= 0);
+
   fd = fdarray[0];
   fd = fdarray[0];
   spawn_func(cpuworker_main, (void*)fdarray);
   spawn_func(cpuworker_main, (void*)fdarray);
   log_debug(LD_OR,"just spawned a cpu worker.");
   log_debug(LD_OR,"just spawned a cpu worker.");

+ 3 - 0
src/or/dns.c

@@ -941,6 +941,9 @@ spawn_dnsworker(void)
     return -1;
     return -1;
   }
   }
 
 
+  tor_assert(fdarray[0] >= 0);
+  tor_assert(fdarray[1] >= 0);
+
   /* log_fn(LOG_NOTICE,"Before spawn: fdarray @%d has %d:%d",
   /* log_fn(LOG_NOTICE,"Before spawn: fdarray @%d has %d:%d",
             (int)fdarray, fdarray[0],fdarray[1]); */
             (int)fdarray, fdarray[0],fdarray[1]); */