[tor-commits] [stegotorus/master] More tiny bugfixes - test suite now reliable on OSX
zwol at torproject.org
zwol at torproject.org
Fri Jul 20 23:17:07 UTC 2012
commit 2021bfe0d20eab807bd3a8276ef0cccc9c106a73
Author: Zack Weinberg <zackw at cmu.edu>
Date: Thu Mar 29 09:06:27 2012 -0700
More tiny bugfixes - test suite now reliable on OSX
---
src/protocol/chop.cc | 12 +++++++-----
src/protocol/null.cc | 9 ++++++++-
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/src/protocol/chop.cc b/src/protocol/chop.cc
index 44e79a3..cf64e6c 100644
--- a/src/protocol/chop.cc
+++ b/src/protocol/chop.cc
@@ -236,6 +236,8 @@ public:
{
reassembly_elt rv = { 0, op_DAT };
uint8_t front = next_to_process & 0xFF;
+ log_debug("next_to_process=%d data=%p op=%02x",
+ next_to_process, cbuf[front].data, cbuf[front].op);
if (cbuf[front].data) {
rv = cbuf[front];
cbuf[front].data = 0;
@@ -255,14 +257,14 @@ public:
insert(uint32_t seqno, opcode_t op, evbuffer *data, conn_t *conn)
{
if (seqno - window() > 255) {
- log_warn(conn, "block outside receive window");
+ log_info(conn, "block outside receive window");
evbuffer_free(data);
return false;
}
uint8_t front = next_to_process & 0xFF;
uint8_t pos = front + (seqno - window());
if (cbuf[pos].data) {
- log_warn(conn, "duplicate block");
+ log_info(conn, "duplicate block");
evbuffer_free(data);
return false;
}
@@ -1193,7 +1195,7 @@ chop_conn_t::recv()
block_header hdr(recv_pending, *upstream->recv_hdr_crypt);
if (!hdr.valid(upstream->recv_queue.window())) {
const uint8_t *c = hdr.cleartext();
- log_warn(this, "invalid block header: %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
+ log_info(this, "invalid block header: %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7],
c[8], c[9], c[10], c[11], c[12], c[13], c[14], c[15]);
return -1;
@@ -1214,11 +1216,11 @@ chop_conn_t::recv()
if (upstream->recv_crypt->decrypt(decodebuf,
decodebuf, hdr.total_len() - HEADER_LEN,
hdr.nonce(), HEADER_LEN)) {
- log_warn("MAC verification failure");
+ log_info("MAC verification failure");
return -1;
}
- log_debug(this, "receiving block %u <d=%lu p=%lu f=%u>",
+ log_debug(this, "receiving block %u <d=%lu p=%lu f=%02x>",
hdr.seqno(), (unsigned long)hdr.dlen(), (unsigned long)hdr.plen(),
(unsigned int)hdr.opcode());
diff --git a/src/protocol/null.cc b/src/protocol/null.cc
index 989ffd4..277eb59 100644
--- a/src/protocol/null.cc
+++ b/src/protocol/null.cc
@@ -137,7 +137,10 @@ null_circuit_t::~null_circuit_t()
/* break the circular reference before deallocating the
downstream connection */
downstream->upstream = NULL;
- delete downstream;
+ if (evbuffer_get_length(downstream->outbound()) > 0)
+ conn_do_flush(downstream);
+ else
+ delete downstream;
}
}
@@ -191,6 +194,9 @@ null_circuit_t::drop_downstream(conn_t *cn)
int
null_circuit_t::send()
{
+ log_debug(this, "sending %lu bytes",
+ evbuffer_get_length(bufferevent_get_input(this->up_buffer)));
+
return evbuffer_add_buffer(this->downstream->outbound(),
bufferevent_get_input(this->up_buffer));
}
@@ -261,6 +267,7 @@ int
null_conn_t::recv()
{
log_assert(this->upstream);
+ log_debug(this, "receiving %lu bytes", evbuffer_get_length(this->inbound()));
return evbuffer_add_buffer(bufferevent_get_output(this->upstream->up_buffer),
this->inbound());
}
More information about the tor-commits
mailing list