aboutsummaryrefslogtreecommitdiff
path: root/src/or/relay.c
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2009-09-21 13:14:39 +0200
committerPeter Palfrader <peter@palfrader.org>2009-09-21 13:14:39 +0200
commita9c45754e0e587dda4e16f888a1662eddf90b1f5 (patch)
treecc5b7aa467419ae63f394e9e3929c38eac316915 /src/or/relay.c
parentb440a4d9369c4a6c4501b289f2e6ff089ba9a519 (diff)
parent54ba86d9d0cff2ceef75d564ece3d7d2ea26af26 (diff)
downloadtor-a9c45754e0e587dda4e16f888a1662eddf90b1f5.tar
tor-a9c45754e0e587dda4e16f888a1662eddf90b1f5.tar.gz
Merge commit 'tor-0.2.2.2-alpha' into debian-merge
* commit 'tor-0.2.2.2-alpha': (94 commits) downgrade a log severity, since this event has been known Update to the "September 4 2009" ip-to-country file. bump to 0.2.2.2-alpha Revert "Teach connection_ap_can_use_exit about Exclude*Nodes" fix grammar / add changelog for the torify commit Fix compile on Snow Leopard Fix build warnings on OSX 10.5.8 Change the condition on the nonlive timeout counting. Add a couple of time helper functions. Fix typos and comments, plus two bugs Implement and document new network liveness algorithm. Fix some precision-related asserts in unit tests. replace contrib/auto-naming with a readme saying where it went clarify our rules for assigning the Named flag disable the end of circuitbuildtimeout units tests draw in a lot of 0.2.1.20 changelog items into 0.2.2.2-alpha Fix compile on freebsd Let our config abbreviations rewrite more than once a mish-mash of stuff in my sandbox give proposal 151 a changelog and other touchups ...
Diffstat (limited to 'src/or/relay.c')
-rw-r--r--src/or/relay.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/or/relay.c b/src/or/relay.c
index c81b8311a..653aa594c 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -1635,7 +1635,8 @@ cell_queue_append_packed_copy(cell_queue_t *queue, const cell_t *cell)
it_pool = mp_pool_new(sizeof(insertion_time_elem_t), 1024);
tor_gettimeofday(&now);
#define SECONDS_IN_A_DAY 86400L
- added = (now.tv_sec % SECONDS_IN_A_DAY) * 100L + now.tv_usec / 10000L;
+ added = (uint32_t)(((now.tv_sec % SECONDS_IN_A_DAY) * 100L)
+ + ((uint32_t)now.tv_usec / (uint32_t)10000L));
if (!it_queue) {
it_queue = tor_malloc_zero(sizeof(insertion_time_queue_t));
queue->insertion_times = it_queue;
@@ -1879,15 +1880,17 @@ connection_or_flush_from_first_active_circuit(or_connection_t *conn, int max,
uint32_t cell_waiting_time;
insertion_time_queue_t *it_queue = queue->insertion_times;
tor_gettimeofday(&now);
- flushed = (now.tv_sec % SECONDS_IN_A_DAY) * 100L +
- now.tv_usec / 10000L;
+ flushed = (uint32_t)((now.tv_sec % SECONDS_IN_A_DAY) * 100L +
+ (uint32_t)now.tv_usec / (uint32_t)10000L);
if (!it_queue || !it_queue->first) {
log_warn(LD_BUG, "Cannot determine insertion time of cell.");
} else {
or_circuit_t *orcirc = TO_OR_CIRCUIT(circ);
insertion_time_elem_t *elem = it_queue->first;
- cell_waiting_time = (flushed * 10L + SECONDS_IN_A_DAY * 1000L -
- elem->insertion_time * 10L) % (SECONDS_IN_A_DAY * 1000L);
+ cell_waiting_time =
+ (uint32_t)((flushed * 10L + SECONDS_IN_A_DAY * 1000L -
+ elem->insertion_time * 10L) %
+ (SECONDS_IN_A_DAY * 1000L));
#undef SECONDS_IN_A_DAY
elem->counter--;
if (elem->counter < 1) {