diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-11-06 19:54:32 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-11-06 19:54:32 +0000 |
commit | 47fd6f7267c5873e75ca485dc6b15ba9bf7b1f3e (patch) | |
tree | da6ff4b0cf808cf72bddb8e84fdf803fe21a621d | |
parent | be1a5191f8e0ca14b6db0880660d5897964fef40 (diff) | |
download | tor-47fd6f7267c5873e75ca485dc6b15ba9bf7b1f3e.tar tor-47fd6f7267c5873e75ca485dc6b15ba9bf7b1f3e.tar.gz |
r16464@catbus: nickm | 2007-11-06 14:53:28 -0500
Also avoid overflow on or_conn->read_bucket
svn:r12401
-rw-r--r-- | src/or/connection.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 40aa72d56..382802e3f 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -1699,9 +1699,11 @@ connection_bucket_refill(int seconds_elapsed, time_t now) if (connection_speaks_cells(conn)) { or_connection_t *or_conn = TO_OR_CONN(conn); if (connection_read_bucket_should_increase(or_conn)) { - or_conn->read_bucket += or_conn->bandwidthrate*seconds_elapsed; - if (or_conn->read_bucket > or_conn->bandwidthburst) - or_conn->read_bucket = or_conn->bandwidthburst; + connection_bucket_refill_helper(&or_conn->read_bucket, + or_conn->bandwidthrate, + or_conn->bandwidthburst, + seconds_elapsed, + "or_conn->read_bucket"); //log_fn(LOG_DEBUG,"Receiver bucket %d now %d.", i, // conn->read_bucket); } |