[or-cvs] it turns out we weren"t looking at the result from getsocko...

Roger Dingledine arma at seul.org
Mon Jul 19 23:26:23 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	connection.c 
Log Message:
it turns out we weren't looking at the result from getsockopt().
now we do.
but i'm not sure it matters, since we also poll for reads, and if
there's an error with the connecting socket, poll is supposed to
return readable, so we should notice it then.

who knows.


Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.241
retrieving revision 1.242
diff -u -d -r1.241 -r1.242
--- connection.c	18 Jul 2004 21:47:04 -0000	1.241
+++ connection.c	19 Jul 2004 23:26:21 -0000	1.242
@@ -834,9 +834,18 @@
   /* Sometimes, "writeable" means "connected". */
   if (connection_state_is_connecting(conn)) {
     if (getsockopt(conn->s, SOL_SOCKET, SO_ERROR, (void*)&e, &len) < 0) {
-      /* not yet */
+      log_fn(LOG_WARN,"getsockopt() syscall failed?! Please report to tor-ops.");
+      connection_close_immediate(conn);
+      connection_mark_for_close(conn);
+      return -1;
+    }
+    if(e) {
+      /* some sort of error, but maybe just inprogress still */
+      errno = e; /* XXX008 this is a kludge. maybe we should rearrange
+                    our error-hunting functions? E.g. pass errno to
+                    tor_socket_errno(). */
       if(!ERRNO_IS_CONN_EINPROGRESS(tor_socket_errno(conn->s))) {
-        log_fn(LOG_DEBUG,"in-progress connect failed. Removing.");
+        log_fn(LOG_INFO,"in-progress connect failed. Removing.");
         connection_close_immediate(conn);
         connection_mark_for_close(conn);
         /* it's safe to pass OPs to router_mark_as_down(), since it just



More information about the tor-commits mailing list