]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Finally solve the "closing wedged cpuworkers" bug. Woo.
authorRoger Dingledine <arma@torproject.org>
Mon, 12 Jun 2006 11:59:19 +0000 (11:59 +0000)
committerRoger Dingledine <arma@torproject.org>
Mon, 12 Jun 2006 11:59:19 +0000 (11:59 +0000)
This happened when we got two create cells in a row from the same TLS
connection. It would hand one to the cpuworker, and then immediately
handle the second one -- after it had registered that the first one was
busy, but before it had updated the timestamp that we use to decide how
*long* it's been busy.

svn:r6606

src/or/cpuworker.c
src/or/dns.c

index 29fd992f62ebb1d69f155e92f9877c2e35c716b1..c86753fb588d547f919c423cfe048708c4d05f40 100644 (file)
@@ -476,6 +476,10 @@ assign_to_cpuworker(connection_t *cpuworker, uint8_t question_type,
     tag_pack(tag, circ->p_conn->addr, circ->p_conn->port, circ->p_circ_id);
 
     cpuworker->state = CPUWORKER_STATE_BUSY_ONION;
+    /* touch the lastwritten timestamp, since that's how we check to
+     * see how long it's been since we asked the question, and sometimes
+     * we check before the first call to connection_handle_write(). */
+    cpuworker->timestamp_lastwritten = time(NULL);
     num_cpuworkers_busy++;
 
     connection_write_to_buf((char*)&question_type, 1, cpuworker);
index 2d3d800c29be1505fe7ea5cdb030b40a6254e5d5..f5e2675db4cbbbe4ba1aee34e263f0b87a3a19b6 100644 (file)
@@ -701,6 +701,10 @@ assign_to_dnsworker(connection_t *exitconn)
   tor_free(dnsconn->address);
   dnsconn->address = tor_strdup(exitconn->address);
   dnsconn->state = DNSWORKER_STATE_BUSY;
+  /* touch the lastwritten timestamp, since that's how we check to
+   * see how long it's been since we asked the question, and sometimes
+   * we check before the first call to connection_handle_write(). */
+  dnsconn->timestamp_lastwritten = time(NULL);
   num_dnsworkers_busy++;
 
   len = strlen(dnsconn->address);