Ticket #7708: 8bdcc8a3.txt

File 8bdcc8a3.txt, 857 bytes (added by nickm, 7 years ago)
Line 
1--- connection.7708.c
2+++ connection.fixup.c
3@@ -3168,6 +3168,7 @@
4   ssize_t max_to_write;
5   time_t now = approx_time();
6   size_t n_read = 0, n_written = 0;
7+  int dont_stop_writing = 0;
8 
9   tor_assert(!connection_is_listener(conn));
10 
11@@ -3259,6 +3260,7 @@
12       case TOR_TLS_WANTWRITE:
13         log_debug(LD_NET,"wanted write.");
14         /* we're already writing */
15+        dont_stop_writing = 1;
16         break;
17       case TOR_TLS_WANTREAD:
18         /* Make sure to avoid a loop if the receive buckets are empty. */
19@@ -3321,7 +3323,8 @@
20       connection_mark_for_close(conn);
21   }
22 
23-  if (!connection_wants_to_flush(conn)) { /* it's done flushing */
24+  if (!connection_wants_to_flush(conn) &&
25+      !dont_stop_writing) { /* it's done flushing */
26     if (connection_finished_flushing(conn) < 0) {
27       /* already marked */
28       return -1;