summaryrefslogtreecommitdiff
path: root/ot_livesync.c
diff options
context:
space:
mode:
Diffstat (limited to 'ot_livesync.c')
-rw-r--r--ot_livesync.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ot_livesync.c b/ot_livesync.c
index 75a5f9f..b87fa6d 100644
--- a/ot_livesync.c
+++ b/ot_livesync.c
@@ -127,13 +127,13 @@ static void livesync_handle_peersync( struct ot_workstruct *ws ) {
127 127
128 /* Now basic sanity checks have been done on the live sync packet 128 /* Now basic sanity checks have been done on the live sync packet
129 We might add more testing and logging. */ 129 We might add more testing and logging. */
130 while( off + (ssize_t)sizeof( ot_hash ) + (ssize_t)sizeof( ot_peer ) <= ws->request_size ) { 130 while( off + (ssize_t)sizeof( ot_hash ) + OT_PEER_SIZE4 <= ws->request_size ) {
131 memcpy( &ws->peer, ws->request + off + sizeof(ot_hash), sizeof( ot_peer ) ); 131 memcpy( &ws->peer, ws->request + off + sizeof(ot_hash), OT_PEER_SIZE4 );
132 ws->hash = (ot_hash*)(ws->request + off); 132 ws->hash = (ot_hash*)(ws->request + off);
133 133
134 if( !g_opentracker_running ) return; 134 if( !g_opentracker_running ) return;
135 135
136 if( OT_PEERFLAG(&ws->peer) & PEER_FLAG_STOPPED ) 136 if( OT_PEERFLAG(ws->peer) & PEER_FLAG_STOPPED )
137 remove_peer_from_torrent( FLAG_MCA, ws ); 137 remove_peer_from_torrent( FLAG_MCA, ws );
138 else 138 else
139 add_peer_to_torrent_and_return_peers( FLAG_MCA, ws, /* amount = */ 0 ); 139 add_peer_to_torrent_and_return_peers( FLAG_MCA, ws, /* amount = */ 0 );
@@ -143,7 +143,7 @@ static void livesync_handle_peersync( struct ot_workstruct *ws ) {
143 143
144 stats_issue_event(EVENT_SYNC, 0, 144 stats_issue_event(EVENT_SYNC, 0,
145 (ws->request_size - sizeof( g_tracker_id ) - sizeof( uint32_t ) ) / 145 (ws->request_size - sizeof( g_tracker_id ) - sizeof( uint32_t ) ) /
146 ((ssize_t)sizeof( ot_hash ) + (ssize_t)sizeof( ot_peer ))); 146 ((ssize_t)sizeof( ot_hash ) + OT_PEER_SIZE4));
147} 147}
148 148
149/* Tickle the live sync module from time to time, so no events get 149/* Tickle the live sync module from time to time, so no events get
@@ -164,9 +164,9 @@ void livesync_tell( struct ot_workstruct *ws ) {
164 pthread_mutex_lock(&g_outbuf_mutex); 164 pthread_mutex_lock(&g_outbuf_mutex);
165 165
166 memcpy( g_outbuf + g_outbuf_data, ws->hash, sizeof(ot_hash) ); 166 memcpy( g_outbuf + g_outbuf_data, ws->hash, sizeof(ot_hash) );
167 memcpy( g_outbuf + g_outbuf_data + sizeof(ot_hash), &ws->peer, sizeof(ot_peer) ); 167 memcpy( g_outbuf + g_outbuf_data + sizeof(ot_hash), &ws->peer, OT_PEER_SIZE4 );
168 168
169 g_outbuf_data += sizeof(ot_hash) + sizeof(ot_peer); 169 g_outbuf_data += sizeof(ot_hash) + OT_PEER_SIZE4;
170 170
171 if( g_outbuf_data >= LIVESYNC_OUTGOING_BUFFSIZE_PEERS - LIVESYNC_OUTGOING_WATERMARK_PEERS ) 171 if( g_outbuf_data >= LIVESYNC_OUTGOING_BUFFSIZE_PEERS - LIVESYNC_OUTGOING_WATERMARK_PEERS )
172 livesync_issue_peersync(); 172 livesync_issue_peersync();