summaryrefslogtreecommitdiff
path: root/ot_udp.c
diff options
context:
space:
mode:
authorerdgeist <>2007-12-15 17:32:44 +0000
committererdgeist <>2007-12-15 17:32:44 +0000
commitcc47504af27e7a1cfbc0c3a416c92d10c0beb70b (patch)
tree561c90ce74a46e3283828660c5491e0b2b771a9a /ot_udp.c
parentcac5a31d9384e242d0adc018455c3f85d52b7622 (diff)
Do not lock out well behaving clients
Diffstat (limited to 'ot_udp.c')
-rw-r--r--ot_udp.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ot_udp.c b/ot_udp.c
index 1133062..7915528 100644
--- a/ot_udp.c
+++ b/ot_udp.c
@@ -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;