summaryrefslogtreecommitdiff
path: root/opentracker.c
diff options
context:
space:
mode:
Diffstat (limited to 'opentracker.c')
-rw-r--r--opentracker.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/opentracker.c b/opentracker.c
index 4ffde37..646184c 100644
--- a/opentracker.c
+++ b/opentracker.c
@@ -441,10 +441,9 @@ ANNOUNCE_WORKAROUND:
441 reply_size = sprintf( static_outbuf + SUCCESS_HTTP_HEADER_LENGTH, "d14:failure reason81:Your client forgot to send your torrent's info_hash. Please upgrade your client.e" ); 441 reply_size = sprintf( static_outbuf + SUCCESS_HTTP_HEADER_LENGTH, "d14:failure reason81:Your client forgot to send your torrent's info_hash. Please upgrade your client.e" );
442 break; 442 break;
443 } 443 }
444 if( OT_FLAG( &peer ) & PEER_FLAG_STOPPED ) { 444 if( OT_FLAG( &peer ) & PEER_FLAG_STOPPED )
445 remove_peer_from_torrent( hash, &peer ); 445 reply_size = remove_peer_from_torrent( hash, &peer, SUCCESS_HTTP_HEADER_LENGTH + static_outbuf, 1 );
446 reply_size = sprintf( static_outbuf + SUCCESS_HTTP_HEADER_LENGTH, "d8:completei0e10:incompletei0e8:intervali%ie5:peers0:e", OT_CLIENT_REQUEST_INTERVAL_RANDOM ); 446 else {
447 } else {
448 torrent = add_peer_to_torrent( hash, &peer, 0 ); 447 torrent = add_peer_to_torrent( hash, &peer, 0 );
449 if( !torrent || !( reply_size = return_peers_for_torrent( torrent, numwant, SUCCESS_HTTP_HEADER_LENGTH + static_outbuf, 1 ) ) ) HTTPERROR_500; 448 if( !torrent || !( reply_size = return_peers_for_torrent( torrent, numwant, SUCCESS_HTTP_HEADER_LENGTH + static_outbuf, 1 ) ) ) HTTPERROR_500;
450 } 449 }
@@ -680,15 +679,9 @@ static void handle_udp4( int64 serversocket ) {
680 outpacket[0] = htonl( 1 ); /* announce action */ 679 outpacket[0] = htonl( 1 ); /* announce action */
681 outpacket[1] = inpacket[12/4]; 680 outpacket[1] = inpacket[12/4];
682 681
683 if( OT_FLAG( &peer ) & PEER_FLAG_STOPPED ) { 682 if( OT_FLAG( &peer ) & PEER_FLAG_STOPPED ) /* Peer is gone. */
684 /* Peer is gone. */ 683 r = remove_peer_from_torrent( hash, &peer, static_outbuf, 0 );
685 remove_peer_from_torrent( hash, &peer ); 684 else {
686
687 /* Create fake packet to satisfy parser on the other end */
688 outpacket[2] = htonl( OT_CLIENT_REQUEST_INTERVAL_RANDOM );
689 outpacket[3] = outpacket[4] = 0;
690 r = 20;
691 } else {
692 torrent = add_peer_to_torrent( hash, &peer, 0 ); 685 torrent = add_peer_to_torrent( hash, &peer, 0 );
693 if( !torrent ) 686 if( !torrent )
694 return; /* XXX maybe send error */ 687 return; /* XXX maybe send error */