[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] make code more readable; arrbitrarily change a -1 to a 0.



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv9955/src/or

Modified Files:
	directory.c main.c 
Log Message:
make code more readable; arrbitrarily change a -1 to a 0.

Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/src/or/directory.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- directory.c	28 Feb 2004 04:11:53 -0000	1.58
+++ directory.c	28 Feb 2004 04:34:27 -0000	1.59
@@ -122,7 +122,7 @@
           log_fn(LOG_INFO,"Empty directory. Ignoring.");
           free(directory);
           connection_mark_for_close(conn,0);
-          return -1;
+          return 0;
         }
         if(router_set_routerlist_from_directory(directory, conn->identity_pkey) < 0){
           log_fn(LOG_INFO,"...but parsing failed. Ignoring.");

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.175
retrieving revision 1.176
diff -u -d -r1.175 -r1.176
--- main.c	28 Feb 2004 04:11:53 -0000	1.175
+++ main.c	28 Feb 2004 04:34:27 -0000	1.176
@@ -176,13 +176,14 @@
 #ifdef MS_WINDOWS
       (poll_array[i].revents & POLLERR) ||
 #endif
-      (connection_handle_read(conn) < 0 && !conn->marked_for_close))
-    {
-      /* this connection is broken. remove it */
-      /* XXX This shouldn't ever happen anymore. */
-      log_fn(LOG_ERR,"Unhandled error on read for %s connection (fd %d); removing",
-             conn_type_to_string[conn->type], conn->s);
-      connection_mark_for_close(conn,0);
+      connection_handle_read(conn) < 0) {
+      if (!conn->marked_for_close) {
+        /* this connection is broken. remove it */
+        /* XXX This shouldn't ever happen anymore. */
+        log_fn(LOG_ERR,"Unhandled error on read for %s connection (fd %d); removing",
+               conn_type_to_string[conn->type], conn->s);
+        connection_mark_for_close(conn,0);
+      }
     }
     assert_connection_ok(conn, time(NULL));
 }
@@ -200,11 +201,13 @@
 
   assert_connection_ok(conn, time(NULL));
 
-  if(connection_handle_write(conn) < 0 && !conn->marked_for_close) {
-    /* this connection is broken. remove it. */
-    log_fn(LOG_ERR,"Unhandled error on read for %s connection (fd %d); removing",
-           conn_type_to_string[conn->type], conn->s);
-    connection_mark_for_close(conn,0);
+  if (connection_handle_write(conn) < 0) {
+    if (!conn->marked_for_close) {
+      /* this connection is broken. remove it. */
+      log_fn(LOG_ERR,"Unhandled error on read for %s connection (fd %d); removing",
+             conn_type_to_string[conn->type], conn->s);
+      connection_mark_for_close(conn,0);
+    }
   }
   assert_connection_ok(conn, time(NULL));
 }