[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r7042: simplify the connection_write_to_buf_zlib() wrapper. (tor/trunk/src/or)



Author: arma
Date: 2006-08-13 19:38:30 -0400 (Sun, 13 Aug 2006)
New Revision: 7042

Modified:
   tor/trunk/src/or/connection.c
   tor/trunk/src/or/dirserv.c
   tor/trunk/src/or/or.h
Log:
simplify the connection_write_to_buf_zlib() wrapper.


Modified: tor/trunk/src/or/connection.c
===================================================================
--- tor/trunk/src/or/connection.c	2006-08-13 14:49:38 UTC (rev 7041)
+++ tor/trunk/src/or/connection.c	2006-08-13 23:38:30 UTC (rev 7042)
@@ -1696,7 +1696,6 @@
 
 void
 connection_write_to_buf_zlib(dir_connection_t *dir_conn,
-                             tor_zlib_state_t *state,
                              const char *data, size_t data_len,
                              int done)
 {
@@ -1713,8 +1712,8 @@
   old_datalen = buf_datalen(conn->outbuf);
   /* XXXX TOO much duplicate code! XXXX012NM */
   CONN_LOG_PROTECT(conn, r = write_to_buf_zlib(
-                                conn->outbuf, state, data, data_len,
-                                done));
+                                conn->outbuf, dir_conn->zlib_state,
+                                data, data_len, done));
   if (r < 0) {
     log_warn(LD_NET,
              "write_to_buf failed. Closing connection (fd %d).", conn->s);

Modified: tor/trunk/src/or/dirserv.c
===================================================================
--- tor/trunk/src/or/dirserv.c	2006-08-13 14:49:38 UTC (rev 7041)
+++ tor/trunk/src/or/dirserv.c	2006-08-13 23:38:30 UTC (rev 7042)
@@ -1829,7 +1829,7 @@
 connection_dirserv_finish_spooling(dir_connection_t *conn)
 {
   if (conn->zlib_state) {
-    connection_write_to_buf_zlib(conn, conn->zlib_state, "", 0, 1);
+    connection_write_to_buf_zlib(conn, "", 0, 1);
     tor_zlib_free(conn->zlib_state);
     conn->zlib_state = NULL;
   }
@@ -1865,10 +1865,8 @@
     body = signed_descriptor_get_body(sd);
     if (conn->zlib_state) {
       int last = ! smartlist_len(conn->fingerprint_stack);
-      connection_write_to_buf_zlib(
-                        conn, conn->zlib_state,
-                        body, sd->signed_descriptor_len,
-                        last);
+      connection_write_to_buf_zlib(conn, body,
+                                   sd->signed_descriptor_len, last);
       if (last) {
         tor_zlib_free(conn->zlib_state);
         conn->zlib_state = NULL;
@@ -1905,7 +1903,7 @@
     bytes = remaining;
 
   if (conn->zlib_state) {
-    connection_write_to_buf_zlib(conn, conn->zlib_state,
+    connection_write_to_buf_zlib(conn,
                              conn->cached_dir->dir_z + conn->cached_dir_offset,
                              bytes, bytes == remaining);
   } else {

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2006-08-13 14:49:38 UTC (rev 7041)
+++ tor/trunk/src/or/or.h	2006-08-13 23:38:30 UTC (rev 7042)
@@ -1836,7 +1836,6 @@
 void connection_write_to_buf(const char *string, size_t len,
                              connection_t *conn);
 void connection_write_to_buf_zlib(dir_connection_t *conn,
-                                  tor_zlib_state_t *state,
                                   const char *data, size_t data_len,
                                   int done);