mirror of
git://erdgeist.org/opentracker
synced 2025-01-11 15:30:07 +00:00
some udp scrape style cleanup
This commit is contained in:
parent
8ac7768b96
commit
46605bcb2c
@ -628,31 +628,31 @@ static void handle_udp4( int64 serversocket ) {
|
|||||||
case 3: OT_FLAG( &peer ) |= PEER_FLAG_STOPPED; break;
|
case 3: OT_FLAG( &peer ) |= PEER_FLAG_STOPPED; break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !left )
|
if( !left )
|
||||||
OT_FLAG( &peer ) |= PEER_FLAG_SEEDING;
|
OT_FLAG( &peer ) |= PEER_FLAG_SEEDING;
|
||||||
|
|
||||||
|
outpacket[0] = htonl( 1 ); /* announce action */
|
||||||
|
outpacket[1] = inpacket[12/4];
|
||||||
|
|
||||||
if( OT_FLAG( &peer ) & PEER_FLAG_STOPPED ) {
|
if( OT_FLAG( &peer ) & PEER_FLAG_STOPPED ) {
|
||||||
/* Peer is gone. */
|
/* Peer is gone. */
|
||||||
remove_peer_from_torrent( hash, &peer );
|
remove_peer_from_torrent( hash, &peer );
|
||||||
|
|
||||||
/* Create fake packet to satisfy parser on the other end */
|
/* Create fake packet to satisfy parser on the other end */
|
||||||
outpacket[0] = htonl( 1 );
|
|
||||||
outpacket[1] = inpacket[12/4];
|
|
||||||
outpacket[2] = htonl( OT_CLIENT_REQUEST_INTERVAL_RANDOM );
|
outpacket[2] = htonl( OT_CLIENT_REQUEST_INTERVAL_RANDOM );
|
||||||
outpacket[3] = outpacket[4] = 0;
|
outpacket[3] = outpacket[4] = 0;
|
||||||
socket_send4( serversocket, static_outbuf, 20, remoteip, remoteport );
|
r = 20;
|
||||||
ot_overall_udp_successfulannounces++;
|
|
||||||
} else {
|
} else {
|
||||||
torrent = add_peer_to_torrent( hash, &peer );
|
torrent = add_peer_to_torrent( hash, &peer );
|
||||||
if( !torrent )
|
if( !torrent )
|
||||||
return; /* XXX maybe send error */
|
return; /* XXX maybe send error */
|
||||||
|
|
||||||
outpacket[0] = htonl( 1 ); /* announce action */
|
|
||||||
outpacket[1] = inpacket[12/4];
|
|
||||||
r = 8 + return_peers_for_torrent( torrent, numwant, static_outbuf + 8, 0 );
|
r = 8 + return_peers_for_torrent( torrent, numwant, static_outbuf + 8, 0 );
|
||||||
socket_send4( serversocket, static_outbuf, r, remoteip, remoteport );
|
|
||||||
ot_overall_udp_successfulannounces++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
socket_send4( serversocket, static_outbuf, r, remoteip, remoteport );
|
||||||
|
ot_overall_udp_successfulannounces++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: /* This is a scrape action */
|
case 2: /* This is a scrape action */
|
||||||
|
Loading…
Reference in New Issue
Block a user