Просмотр исходного кода

Merge remote-tracking branch 'origin/maint-0.2.5'

Nick Mathewson 9 лет назад
Родитель
Сommit
e7e92fb2f9
3 измененных файлов с 18 добавлено и 7 удалено
  1. 3 2
      changes/bufferevent_compilation
  2. 4 3
      src/or/channel.c
  3. 11 2
      src/test/test_oom.c

+ 3 - 2
changes/bufferevent_compilation

@@ -1,5 +1,6 @@
   o Minor bugfixes:
     - Fix compilation when building with bufferevents enabled. (This
       configuration is still not expected to work, however.)
-      Fixes bugs 12438, 12474; bugfixes on 0.2.5.1-alpha. Patches
-      from Anthony G. Basile.
+      Fixes bugs 12438, 12474, 11578; bugfixes on 0.2.5.1-alpha and
+      0.2.5.3-alpha. Patches from Anthony G. Basile and Sathyanarayanan
+      Gunasekaran.

+ 4 - 3
src/or/channel.c

@@ -19,6 +19,7 @@
 #include "circuitbuild.h"
 #include "circuitlist.h"
 #include "circuitstats.h"
+#include "config.h"
 #include "connection_or.h" /* For var_cell_free() */
 #include "circuitmux.h"
 #include "entrynodes.h"
@@ -3277,9 +3278,9 @@ channel_dump_statistics(channel_t *chan, int severity)
         " is %s, and gives a canonical description of \"%s\" and an "
         "actual description of \"%s\"",
         U64_PRINTF_ARG(chan->global_identifier),
-        remote_addr_str,
-        channel_get_canonical_remote_descr(chan),
-        actual);
+        safe_str(remote_addr_str),
+        safe_str(channel_get_canonical_remote_descr(chan)),
+        safe_str(actual));
     tor_free(remote_addr_str);
     tor_free(actual);
   } else {

+ 11 - 2
src/test/test_oom.c

@@ -97,16 +97,25 @@ dummy_edge_conn_new(circuit_t *circ,
                     int type, size_t in_bytes, size_t out_bytes)
 {
   edge_connection_t *conn;
+  generic_buffer_t *inbuf, *outbuf;
 
   if (type == CONN_TYPE_EXIT)
     conn = edge_connection_new(type, AF_INET);
   else
     conn = ENTRY_TO_EDGE_CONN(entry_connection_new(type, AF_INET));
 
+#ifdef USE_BUFFEREVENTS
+  inbuf = bufferevent_get_input(TO_CONN(conn)->bufev);
+  outbuf = bufferevent_get_output(TO_CONN(conn)->bufev);
+#else
+  inbuf = TO_CONN(conn)->inbuf;
+  outbuf = TO_CONN(conn)->outbuf;
+#endif
+
   /* We add these bytes directly to the buffers, to avoid all the
    * edge connection read/write machinery. */
-  add_bytes_to_buf(TO_CONN(conn)->inbuf, in_bytes);
-  add_bytes_to_buf(TO_CONN(conn)->outbuf, out_bytes);
+  add_bytes_to_buf(inbuf, in_bytes);
+  add_bytes_to_buf(outbuf, out_bytes);
 
   conn->on_circuit = circ;
   if (type == CONN_TYPE_EXIT) {