diff options
Diffstat (limited to 'ot_livesync.c')
-rw-r--r-- | ot_livesync.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ot_livesync.c b/ot_livesync.c index 1b1efe0..b447e83 100644 --- a/ot_livesync.c +++ b/ot_livesync.c | |||
@@ -94,10 +94,11 @@ static void livesync_issuepacket( ) { | |||
94 | 94 | ||
95 | /* Inform live sync about whats going on. */ | 95 | /* Inform live sync about whats going on. */ |
96 | void livesync_tell( ot_hash * const info_hash, const ot_peer * const peer ) { | 96 | void livesync_tell( ot_hash * const info_hash, const ot_peer * const peer ) { |
97 | memmove( livesync_outbuffer_pos , info_hash, sizeof(ot_hash)); | 97 | int i; |
98 | memmove( livesync_outbuffer_pos + sizeof(ot_hash), peer, sizeof(ot_peer)); | 98 | for(i=0;i<20;i+=4) WRITE32(livesync_outbuffer_pos+=4,0,READ32(info_hash,i)); |
99 | 99 | WRITE32(livesync_outbuffer_pos+=4,0,READ32(peer,0)); | |
100 | livesync_outbuffer_pos += sizeof(ot_hash) + sizeof(ot_peer); | 100 | WRITE32(livesync_outbuffer_pos+=4,0,READ32(peer,4)); |
101 | |||
101 | if( livesync_outbuffer_pos >= livesync_outbuffer_highwater ) | 102 | if( livesync_outbuffer_pos >= livesync_outbuffer_highwater ) |
102 | livesync_issuepacket(); | 103 | livesync_issuepacket(); |
103 | } | 104 | } |
@@ -146,7 +147,7 @@ static void * livesync_worker( void * args ) { | |||
146 | ot_peer *peer = (ot_peer*)(livesync_inbuffer + off + sizeof(ot_hash)); | 147 | ot_peer *peer = (ot_peer*)(livesync_inbuffer + off + sizeof(ot_hash)); |
147 | ot_hash *hash = (ot_hash*)(livesync_inbuffer + off); | 148 | ot_hash *hash = (ot_hash*)(livesync_inbuffer + off); |
148 | 149 | ||
149 | if( OT_FLAG(peer) & PEER_FLAG_STOPPED ) | 150 | if( OT_PEERFLAG(peer) & PEER_FLAG_STOPPED ) |
150 | remove_peer_from_torrent(hash, peer, NULL, FLAG_MCA); | 151 | remove_peer_from_torrent(hash, peer, NULL, FLAG_MCA); |
151 | else | 152 | else |
152 | add_peer_to_torrent( hash, peer WANT_SYNC_PARAM(1)); | 153 | add_peer_to_torrent( hash, peer WANT_SYNC_PARAM(1)); |