[or-cvs] Add other side of half-open-connection logic (still disabled
Nick Mathewson
nickm at seul.org
Wed Mar 19 22:05:37 UTC 2003
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv421/src/or
Modified Files:
connection_ap.c connection_exit.c
Log Message:
Add other side of half-open-connection logic (still disabled
Index: connection_ap.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_ap.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- connection_ap.c 19 Mar 2003 21:59:07 -0000 1.30
+++ connection_ap.c 19 Mar 2003 22:05:35 -0000 1.31
@@ -11,9 +11,34 @@
assert(conn && conn->type == CONN_TYPE_AP);
if(conn->inbuf_reached_eof) {
+#ifdef HALF_OPEN
+ /* eof reached; we're done reading, but we might want to write more. */
+ conn->done_receiving = 1;
+ shutdown(conn->s, 0); /* XXX check return, refactor NM */
+ if (conn->done_sending)
+ conn->marked_for_close = 1;
+
+ /* XXX Factor out common logic here and in circuit_about_to_close NM */
+ circ = circuit_get_by_conn(conn);
+ if (!circ)
+ return -1;
+
+ memset(&cell, 0, sizeof(cell_t));
+ cell.command = CELL_DATA;
+ cell.length = TOPIC_HEADER_SIZE;
+ *(uint16_t *)(cell.payload+2) = htons(conn->topic_id);
+ *cell.payload = TOPIC_COMMAND_END;
+ cell.aci = circ->n_aci;
+ if (circuit_deliver_data_cell_from_edge(&cell, circ, EDGE_AP) < 0) {
+ log(LOG_DEBUG,"connection_ap_process_inbuf: circuit_deliver_data_cell_from_edge failed. Closing");
+ circuit_close(circ);
+ }
+ return 0;
+#else
/* eof reached, kill it. */
log(LOG_DEBUG,"connection_ap_process_inbuf(): conn reached eof. Closing.");
return -1;
+#endif
}
// log(LOG_DEBUG,"connection_ap_process_inbuf(): state %d.",conn->state);
Index: connection_exit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_exit.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- connection_exit.c 19 Mar 2003 21:59:07 -0000 1.24
+++ connection_exit.c 19 Mar 2003 22:05:35 -0000 1.25
@@ -12,8 +12,6 @@
if(conn->inbuf_reached_eof) {
#ifdef HALF_OPEN
- /* XXX!!! If this is right, duplicate it in connection_ap.c */
-
/* eof reached; we're done reading, but we might want to write more. */
conn->done_receiving = 1;
shutdown(conn->s, 0); /* XXX check return, refactor NM */
More information about the tor-commits
mailing list