summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/or/main.c2
-rw-r--r--src/or/or.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/or/main.c b/src/or/main.c
index b54417e422..d10996b699 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -597,7 +597,7 @@ run_connection_housekeeping(int i, time_t now)
}
/* 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);
diff --git a/src/or/or.h b/src/or/or.h
index 61c0bc4b4f..b1de27902a 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -305,6 +305,8 @@ typedef enum {
#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