diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-02-27 19:19:34 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-02-27 19:19:34 +0000 |
commit | eefe2a3562eeedeb8a185b1c7f313181c391ec31 (patch) | |
tree | 713231b36fa590f823a3448bb4398ad9332ab800 /src/or/connection.c | |
parent | d14f8f2547df35434547d8e3e2b4c1a6b7736597 (diff) | |
download | tor-eefe2a3562eeedeb8a185b1c7f313181c391ec31.tar.gz tor-eefe2a3562eeedeb8a185b1c7f313181c391ec31.zip |
r18462@catbus: nickm | 2008-02-27 14:15:57 -0500
Add better warnings for the error that produced bug 614, and downgrade from a tor_assert() to a tor_fragile_assert().
svn:r13752
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 27c15c7b7d..9e559530da 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -1576,8 +1576,16 @@ connection_buckets_decrement(connection_t *conn, time_t now, { if (!connection_is_rate_limited(conn)) return; /* local IPs are free */ - tor_assert(num_read < INT_MAX); - tor_assert(num_written < INT_MAX); + if (num_written >= INT_MAX || num_read >= INT_MAX) { + log_err(LD_BUG, "Value out of range. num_read=%lu, num_written=%lu, " + "connection type=%s, state=%s", + (unsigned long)num_read, (unsigned long)num_written, + conn_type_to_string(conn->type), + conn_state_to_string(conn->type, conn->state)); + if (num_written >= INT_MAX) num_written = 1; + if (num_read >= INT_MAX) num_read = 1; + tor_fragile_assert(); + } if (num_read > 0) rep_hist_note_bytes_read(num_read, now); |