From 1a40cebcbde3919704f148e1f41985fb36bedc9b Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Tue, 3 Feb 2009 17:00:51 +0000 Subject: Read action codes from correct location and tell ot_stats the correct number of incoming peers. --- ot_livesync.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ot_livesync.c b/ot_livesync.c index 3f54a4d..45d4160 100644 --- a/ot_livesync.c +++ b/ot_livesync.c @@ -173,7 +173,9 @@ static void livesync_handle_peersync( ssize_t datalen ) { off += sizeof( ot_hash ) + sizeof( ot_peer ); } - stats_issue_event(EVENT_SYNC, 0, datalen / ((ssize_t)sizeof( ot_hash ) + (ssize_t)sizeof( ot_peer ))); + stats_issue_event(EVENT_SYNC, 0, + (datalen - sizeof( g_tracker_id ) - sizeof( uint32_t ) ) / + ((ssize_t)sizeof( ot_hash ) + (ssize_t)sizeof( ot_peer ))); } #ifdef WANT_SYNC_SCRAPE @@ -386,7 +388,7 @@ static void * livesync_worker( void * args ) { continue; } - switch( uint32_read_big( (char*)g_inbuffer ) ) { + switch( uint32_read_big( sizeof( g_tracker_id ) + (char*)g_inbuffer ) ) { case OT_SYNC_PEER: livesync_handle_peersync( datalen ); break; -- cgit v1.2.3