[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stegotorus/master] Fix that race condition in connection setup again. This time for sure!
commit e0ade2128ee7b21cede4b2477b5f00f0f2f8d51c
Author: Zack Weinberg <zackw@xxxxxxx>
Date: Wed Jun 13 15:06:13 2012 -0400
Fix that race condition in connection setup again. This time for sure!
---
src/protocol/chop.cc | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/src/protocol/chop.cc b/src/protocol/chop.cc
index 67ed2b3..20ba563 100644
--- a/src/protocol/chop.cc
+++ b/src/protocol/chop.cc
@@ -903,11 +903,22 @@ chop_circuit_t::pick_connection(size_t desired, size_t *blocksize)
for (unordered_set<chop_conn_t *>::iterator i = downstreams.begin();
i != downstreams.end(); i++) {
chop_conn_t *conn = *i;
+
+ // We cannot transmit on a connection whose steganography module has
+ // not yet been instantiated. (This only ever happens server-side.)
if (!conn->steg) {
log_debug(conn, "offers 0 bytes (no steg)");
continue;
}
+ // We must not transmit on a connection that has not completed its
+ // TCP handshake. (This only ever happens client-side. If we try
+ // it anyway, the transmission gets silently dropped on the floor.)
+ if (!conn->connected) {
+ log_debug(conn, "offers 0 bytes (not connected)");
+ continue;
+ }
+
size_t shake = conn->sent_handshake ? 0 : HANDSHAKE_LEN;
size_t room = conn->steg->transmit_room(desired + shake, lo + shake,
MAX_BLOCK_SIZE + shake);
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits