aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection_ap.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_ap.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_ap.c')
-rw-r--r--src/or/connection_ap.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/or/connection_ap.c b/src/or/connection_ap.c
index 9d28d5a4a..339c14137 100644
--- a/src/or/connection_ap.c
+++ b/src/or/connection_ap.c
@@ -418,11 +418,21 @@ int connection_ap_process_data_cell(cell_t *cell, circuit_t *circ) {
}
log(LOG_DEBUG,"connection_ap_process_data_cell(): willing to receive %d more cells from circ",conn->n_receive_topicwindow);
+#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) {
conn->marked_for_close = 1;
return 0;
}
+#endif
if(connection_consider_sending_sendme(conn, EDGE_AP) < 0)
conn->marked_for_close = 1;
return 0;
@@ -441,6 +451,12 @@ int connection_ap_process_data_cell(cell_t *cell, circuit_t *circ) {
for(prevconn = circ->p_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: