[or-cvs] push out a tls record"s worth of data once you"ve got it
Roger Dingledine
arma at seul.org
Tue Jan 20 02:14:54 UTC 2004
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or
Modified Files:
connection.c
Log Message:
push out a tls record's worth of data once you've got it
Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -d -r1.146 -r1.147
--- connection.c 6 Jan 2004 07:53:40 -0000 1.146
+++ connection.c 20 Jan 2004 02:14:51 -0000 1.147
@@ -380,9 +380,9 @@
} else {
/* do a rudimentary round-robin so one connection can't hog a thickpipe */
if(connection_speaks_cells(conn)) {
- at_most = 30*(CELL_NETWORK_SIZE);
+ at_most = 32*(CELL_NETWORK_SIZE);
} else {
- at_most = 30*(RELAY_PAYLOAD_SIZE);
+ at_most = 32*(RELAY_PAYLOAD_SIZE);
}
if(at_most > global_read_bucket)
@@ -524,6 +524,21 @@
/* XXX if linkpadding, this only applies to conns that aren't open OR connections */
connection_start_writing(conn);
+#define MIN_TLS_FLUSHLEN 16300
+/* openssl tls record size is 16383, this is close. The goal here is to
+ * push data out as soon as we know there's enough for a tls record, so
+ * during periods of high load we won't read the entire megabyte from
+ * input before pushing any data out. */
+/* We follow the same algorithm for non-tls streams, because hey, why not. */
+ if(conn->outbuf_flushlen < MIN_TLS_FLUSHLEN &&
+ conn->outbuf_flushlen+len >= MIN_TLS_FLUSHLEN) {
+ len -= (MIN_TLS_FLUSHLEN - conn->outbuf_flushlen);
+ conn->outbuf_flushlen = MIN_TLS_FLUSHLEN;
+ if(connection_handle_write(conn) < 0) {
+ conn->marked_for_close = 1;
+ log_fn(LOG_WARN,"flushing failed.");
+ }
+ }
conn->outbuf_flushlen += len;
}
More information about the tor-commits
mailing list