diff options
author | denis <> | 2007-03-16 23:04:24 +0000 |
---|---|---|
committer | denis <> | 2007-03-16 23:04:24 +0000 |
commit | 46605bcb2c08afcad8a887cac1b70b848915d87a (patch) | |
tree | 83faef5fa74dfd36eea8bf8a2812b9de0fd4e10a /opentracker.c | |
parent | 8ac7768b961d3ef90e4b4b7ac6fc6b2322f1aa7f (diff) |
some udp scrape style cleanup
Diffstat (limited to 'opentracker.c')
-rw-r--r-- | opentracker.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/opentracker.c b/opentracker.c index 2fb6bf5..9e0a18c 100644 --- a/opentracker.c +++ b/opentracker.c | |||
@@ -628,31 +628,31 @@ static void handle_udp4( int64 serversocket ) { | |||
628 | case 3: OT_FLAG( &peer ) |= PEER_FLAG_STOPPED; break; | 628 | case 3: OT_FLAG( &peer ) |= PEER_FLAG_STOPPED; break; |
629 | default: break; | 629 | default: break; |
630 | } | 630 | } |
631 | |||
631 | if( !left ) | 632 | if( !left ) |
632 | OT_FLAG( &peer ) |= PEER_FLAG_SEEDING; | 633 | OT_FLAG( &peer ) |= PEER_FLAG_SEEDING; |
633 | 634 | ||
635 | outpacket[0] = htonl( 1 ); /* announce action */ | ||
636 | outpacket[1] = inpacket[12/4]; | ||
637 | |||
634 | if( OT_FLAG( &peer ) & PEER_FLAG_STOPPED ) { | 638 | if( OT_FLAG( &peer ) & PEER_FLAG_STOPPED ) { |
635 | /* Peer is gone. */ | 639 | /* Peer is gone. */ |
636 | remove_peer_from_torrent( hash, &peer ); | 640 | remove_peer_from_torrent( hash, &peer ); |
637 | 641 | ||
638 | /* Create fake packet to satisfy parser on the other end */ | 642 | /* Create fake packet to satisfy parser on the other end */ |
639 | outpacket[0] = htonl( 1 ); | ||
640 | outpacket[1] = inpacket[12/4]; | ||
641 | outpacket[2] = htonl( OT_CLIENT_REQUEST_INTERVAL_RANDOM ); | 643 | outpacket[2] = htonl( OT_CLIENT_REQUEST_INTERVAL_RANDOM ); |
642 | outpacket[3] = outpacket[4] = 0; | 644 | outpacket[3] = outpacket[4] = 0; |
643 | socket_send4( serversocket, static_outbuf, 20, remoteip, remoteport ); | 645 | r = 20; |
644 | ot_overall_udp_successfulannounces++; | ||
645 | } else { | 646 | } else { |
646 | torrent = add_peer_to_torrent( hash, &peer ); | 647 | torrent = add_peer_to_torrent( hash, &peer ); |
647 | if( !torrent ) | 648 | if( !torrent ) |
648 | return; /* XXX maybe send error */ | 649 | return; /* XXX maybe send error */ |
649 | 650 | ||
650 | outpacket[0] = htonl( 1 ); /* announce action */ | ||
651 | outpacket[1] = inpacket[12/4]; | ||
652 | r = 8 + return_peers_for_torrent( torrent, numwant, static_outbuf + 8, 0 ); | 651 | r = 8 + return_peers_for_torrent( torrent, numwant, static_outbuf + 8, 0 ); |
653 | socket_send4( serversocket, static_outbuf, r, remoteip, remoteport ); | ||
654 | ot_overall_udp_successfulannounces++; | ||
655 | } | 652 | } |
653 | |||
654 | socket_send4( serversocket, static_outbuf, r, remoteip, remoteport ); | ||
655 | ot_overall_udp_successfulannounces++; | ||
656 | break; | 656 | break; |
657 | 657 | ||
658 | case 2: /* This is a scrape action */ | 658 | case 2: /* This is a scrape action */ |