[or-cvs] Be loud when decompressing

Nick Mathewson nickm at seul.org
Wed Mar 19 22:47:36 UTC 2003


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv4222/src/or

Modified Files:
	buffers.c connection.c connection_exit.c 
Log Message:
Be loud when decompressing

Index: buffers.c
===================================================================
RCS file: /home/or/cvsroot/src/or/buffers.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- buffers.c	19 Mar 2003 22:28:52 -0000	1.14
+++ buffers.c	19 Mar 2003 22:47:34 -0000	1.15
@@ -192,6 +192,9 @@
     {
     case Z_OK:
     case Z_STREAM_END:
+      log(LOG_DEBUG, "Uncompressed (%d/%d); filled (%d/%d)",
+	  *buf_datalen_in-zstream->avail_in, *buf_datalen_in,
+	  *buf_datalen_out-zstream->avail_out, *buf_datalen_out);
       memmove(*buf_in, zstream->next_in, zstream->avail_in);
       *buf_datalen_in = zstream->avail_in;
       *buf_datalen_out = *buflen_out - zstream->avail_out;

Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- connection.c	19 Mar 2003 22:27:01 -0000	1.46
+++ connection.c	19 Mar 2003 22:47:34 -0000	1.47
@@ -744,7 +744,7 @@
     return -1;
   }
 
-  log(LOG_DEBUG,"connection_package_raw_inbuf(): (%d) Packaging %d bytes (%d waiting).",conn->s,cell.length, amount_to_process);
+  log(LOG_DEBUG,"connection_package_raw_inbuf(): (%d) Packaging %d bytes (%d waiting).",conn->s,cell.length, conn->inbuf_datalen);
 
   *(uint16_t *)(cell.payload+2) = htons(conn->topic_id);
   *cell.payload = TOPIC_COMMAND_DATA;

Index: connection_exit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_exit.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- connection_exit.c	19 Mar 2003 22:05:35 -0000	1.25
+++ connection_exit.c	19 Mar 2003 22:47:34 -0000	1.26
@@ -196,6 +196,7 @@
   connection_t *conn;
   int topic_command;
   int topic_id;
+  int len;
   static int num_seen=0;
 
   /* an outgoing data cell has arrived */
@@ -248,16 +249,19 @@
       if(conn->state != EXIT_CONN_STATE_OPEN) {
         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_DEBUG,"connection_exit_process_data_cell(): uncompressing %d bytes onto outbuf...",cell->length - TOPIC_HEADER_SIZE);
+      len = connection_decompress_to_buf(cell->payload + TOPIC_HEADER_SIZE,
+					 cell->length - TOPIC_HEADER_SIZE, 
+					 conn, Z_SYNC_FLUSH);
+      log(LOG_DEBUG,"%d bytes written", len);
+      if (len<0) {
         log(LOG_INFO,"connection_exit_process_data_cell(): write to buf failed. Marking for close.");
         conn->marked_for_close = 1;
         return 0;
       }
 #else
+      log(LOG_DEBUG,"connection_exit_process_data_cell(): put %d bytes on outbuf.",cell->length - TOPIC_HEADER_SIZE);
       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.");



More information about the tor-commits mailing list