[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] push out a tls record"s worth of data once you"ve got it
- To: or-cvs@freehaven.net
- Subject: [or-cvs] push out a tls record"s worth of data once you"ve got it
- From: arma@seul.org (Roger Dingledine)
- Date: Mon, 19 Jan 2004 21:14:54 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Mon, 19 Jan 2004 21:15:13 -0500
- Reply-to: or-dev@freehaven.net
- Sender: owner-or-cvs@freehaven.net
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;
}