diff options
-rw-r--r-- | ot_udp.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -57,15 +57,16 @@ void handle_udp4( int64 serversocket ) { | |||
57 | if( r < 16 ) | 57 | if( r < 16 ) |
58 | return; | 58 | return; |
59 | 59 | ||
60 | /* look for udp bittorrent magic id */ | ||
61 | if( (ntohl(inpacket[0]) != 0x00000417) || (ntohl(inpacket[1]) != 0x27101980) ) | ||
62 | return; | ||
63 | |||
64 | switch( ntohl( inpacket[2] ) ) { | 60 | switch( ntohl( inpacket[2] ) ) { |
65 | case 0: /* This is a connect action */ | 61 | case 0: /* This is a connect action */ |
62 | /* look for udp bittorrent magic id */ | ||
63 | if( (ntohl(inpacket[0]) != 0x00000417) || (ntohl(inpacket[1]) != 0x27101980) ) | ||
64 | return; | ||
65 | |||
66 | outpacket[0] = 0; | 66 | outpacket[0] = 0; |
67 | outpacket[1] = inpacket[3]; | 67 | outpacket[1] = inpacket[3]; |
68 | udp_make_connectionid( outpacket + 2, remoteip ); | 68 | udp_make_connectionid( outpacket + 2, remoteip ); |
69 | |||
69 | socket_send4( serversocket, static_outbuf, 16, remoteip, remoteport ); | 70 | socket_send4( serversocket, static_outbuf, 16, remoteip, remoteport ); |
70 | stats_issue_event( EVENT_CONNECT, 0, 16 ); | 71 | stats_issue_event( EVENT_CONNECT, 0, 16 ); |
71 | break; | 72 | break; |