From 175c37c3e89f179a3da82a66b06b931b24a52b98 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Mon, 5 Mar 2007 21:14:50 +0000 Subject: Can now handle multiple ips/ports, can BIND to udp ports but not yet handle them, now checks if event=completed comes with left=0 and drops it, if it doesnt --- trackerlogic.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'trackerlogic.c') diff --git a/trackerlogic.c b/trackerlogic.c index 3b83b77..18e8cf5 100644 --- a/trackerlogic.c +++ b/trackerlogic.c @@ -221,6 +221,10 @@ ot_torrent *add_peer_to_torrent( ot_hash *hash, ot_peer *peer ) { } else clean_peerlist( NOW, torrent->peer_list ); + /* Sanitize flags: Whoever claims to have completed download, must be a seeder */ + if( ( OT_FLAG( peer ) & ( PEER_FLAG_COMPLETED | PEER_FLAG_SEEDING ) ) == PEER_FLAG_COMPLETED ) + OT_FLAG( peer ) ^= PEER_FLAG_COMPLETED; + peer_pool = &torrent->peer_list->peers[0]; peer_dest = vector_find_or_insert( peer_pool, (void*)peer, sizeof( ot_peer ), OT_PEER_COMPARE_SIZE, &exactmatch ); -- cgit v1.2.3