[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] avoid racing the mark-for-close when the client hangs up on...
- To: or-cvs@freehaven.net
- Subject: [or-cvs] avoid racing the mark-for-close when the client hangs up on...
- From: arma@seul.org (Roger Dingledine)
- Date: Fri, 6 Aug 2004 22:19:51 -0400 (EDT)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Fri, 06 Aug 2004 22:19:58 -0400
- Reply-to: or-dev@freehaven.net
- Sender: owner-or-cvs@freehaven.net
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or
Modified Files:
connection_edge.c relay.c
Log Message:
avoid racing the mark-for-close when the client hangs up on us
at the same time we get an end relay cell.
(thanks to wmf for reminding me)
Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.204
retrieving revision 1.205
diff -u -d -r1.204 -r1.205
--- connection_edge.c 7 Aug 2004 00:19:14 -0000 1.204
+++ connection_edge.c 7 Aug 2004 02:19:49 -0000 1.205
@@ -54,7 +54,11 @@
/* eof reached, kill it. */
log_fn(LOG_INFO,"conn (fd %d) reached eof. Closing.", conn->s);
connection_edge_end(conn, END_STREAM_REASON_DONE, conn->cpath_layer);
- connection_mark_for_close(conn);
+ if(!conn->marked_for_close) {
+ /* only mark it if not already marked. it's possible to
+ * get the 'end' right around when the client hangs up on us. */
+ connection_mark_for_close(conn);
+ }
conn->hold_open_until_flushed = 1; /* just because we shouldn't read
doesn't mean we shouldn't write */
return 0;
Index: relay.c
===================================================================
RCS file: /home/or/cvsroot/src/or/relay.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- relay.c 5 Aug 2004 00:39:23 -0000 1.8
+++ relay.c 7 Aug 2004 02:19:49 -0000 1.9
@@ -694,7 +694,11 @@
#else
/* We just *got* an end; no reason to send one. */
conn->has_sent_end = 1;
- connection_mark_for_close(conn);
+ if(!conn->marked_for_close) {
+ /* only mark it if not already marked. it's possible to
+ * get the 'end' right around when the client hangs up on us. */
+ connection_mark_for_close(conn);
+ }
conn->hold_open_until_flushed = 1;
#endif
return 0;