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

[or-cvs] r8271: fix bug found by Adam J. Richter: directory clients shouldn' (tor/trunk/src/or)



Author: arma
Date: 2006-08-28 14:51:36 -0400 (Mon, 28 Aug 2006)
New Revision: 8271

Modified:
   tor/trunk/src/or/main.c
   tor/trunk/src/or/or.h
Log:
fix bug found by Adam J. Richter: directory clients shouldn't
hang up five minutes after they begin. but directory servers
should still hang up after 5 minutes of failing to deliver
any bytes.


Modified: tor/trunk/src/or/main.c
===================================================================
--- tor/trunk/src/or/main.c	2006-08-28 08:24:36 UTC (rev 8270)
+++ tor/trunk/src/or/main.c	2006-08-28 18:51:36 UTC (rev 8271)
@@ -597,7 +597,7 @@
   }
 
   /* Expire any directory connections that haven't sent anything for 5 min */
-  if (conn->type == CONN_TYPE_DIR &&
+  if (conn->type == CONN_TYPE_DIR && DIR_CONN_IS_SERVER(conn) &&
       conn->timestamp_lastwritten + DIR_CONN_MAX_STALL < now) {
     log_info(LD_DIR,"Expiring wedged directory conn (fd %d, purpose %d)",
              conn->s, conn->purpose);

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2006-08-28 08:24:36 UTC (rev 8270)
+++ tor/trunk/src/or/or.h	2006-08-28 18:51:36 UTC (rev 8271)
@@ -305,6 +305,8 @@
 #define DIR_CONN_STATE_SERVER_WRITING 6
 #define _DIR_CONN_STATE_MAX 6
 
+#define DIR_CONN_IS_SERVER(conn) ((conn)->purpose == DIR_PURPOSE_SERVER)
+
 #define _CONTROL_CONN_STATE_MIN 1
 #define CONTROL_CONN_STATE_OPEN_V0 1
 #define CONTROL_CONN_STATE_OPEN_V1 2