]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix warning on building with bufferevents
authorSathyanarayanan Gunasekaran <gsathya.ceg@gmail.com>
Sun, 20 Jul 2014 23:06:26 +0000 (16:06 -0700)
committerNick Mathewson <nickm@torproject.org>
Mon, 21 Jul 2014 17:58:14 +0000 (13:58 -0400)
Fixes #11578

src/test/test_oom.c

index 32f4803bbaee6fda6c556d4823d11d3e379817f1..2726056b807cd8eb657fb98ff78e6f190f7369a7 100644 (file)
@@ -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) {