aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection_exit.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2003-03-17 02:42:45 +0000
committerNick Mathewson <nickm@torproject.org>2003-03-17 02:42:45 +0000
commit6deed60bb5b5f495b4812f15c0e7a3b21fc440e4 (patch)
treec252e7c1d706abdf838ea32166c384819f6a6b4d /src/or/connection_exit.c
parent9a6b01ba44d1c43865d0c4da08133737dcb761cf (diff)
downloadtor-6deed60bb5b5f495b4812f15c0e7a3b21fc440e4.tar
tor-6deed60bb5b5f495b4812f15c0e7a3b21fc440e4.tar.gz
Add code for end-to-end zlib compression. Still needs flow-control
svn:r187
Diffstat (limited to 'src/or/connection_exit.c')
-rw-r--r--src/or/connection_exit.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/or/connection_exit.c b/src/or/connection_exit.c
index fb0daadc4..857dfe884 100644
--- a/src/or/connection_exit.c
+++ b/src/or/connection_exit.c
@@ -217,12 +217,22 @@ int connection_exit_process_data_cell(cell_t *cell, circuit_t *circ) {
log(LOG_DEBUG,"connection_exit_process_data_cell(): data received while resolving/connecting. Queueing.");
}
log(LOG_DEBUG,"connection_exit_process_data_cell(): put %d bytes on outbuf.",cell->length - TOPIC_HEADER_SIZE);
+#ifdef USE_ZLIB
+ if(connection_decompress_to_buf(cell->payload + TOPIC_HEADER_SIZE,
+ cell->length - TOPIC_HEADER_SIZE,
+ conn, Z_SYNC_FLUSH) < 0) {
+ log(LOG_INFO,"connection_exit_process_data_cell(): write to buf failed. Marking for close.");
+ conn->marked_for_close = 1;
+ return 0;
+ }
+#else
if(connection_write_to_buf(cell->payload + TOPIC_HEADER_SIZE,
cell->length - TOPIC_HEADER_SIZE, conn) < 0) {
log(LOG_INFO,"connection_exit_process_data_cell(): write to buf failed. Marking for close.");
conn->marked_for_close = 1;
return 0;
}
+#endif
if(connection_consider_sending_sendme(conn, EDGE_EXIT) < 0)
conn->marked_for_close = 1;
return 0;
@@ -241,6 +251,13 @@ int connection_exit_process_data_cell(cell_t *cell, circuit_t *circ) {
for(prevconn = circ->n_conn; prevconn->next_topic != conn; prevconn = prevconn->next_topic) ;
prevconn->next_topic = conn->next_topic;
#endif
+#if 0
+ conn->done_sending = 1;
+ shutdown(conn->s, 1); /* XXX check return; refactor NM */
+ if (conn->done_receiving)
+ conn->marked_for_close = 1;
+#endif
+
conn->marked_for_close = 1;
break;
case TOPIC_COMMAND_CONNECTED: