From cc47504af27e7a1cfbc0c3a416c92d10c0beb70b Mon Sep 17 00:00:00 2001
From: erdgeist <>
Date: Sat, 15 Dec 2007 17:32:44 +0000
Subject: Do not lock out well behaving clients

---
 ot_udp.c | 9 +++++----
 1 file 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 ) {
   if( r < 16 )
     return;
 
-  /* look for udp bittorrent magic id */
-  if( (ntohl(inpacket[0]) != 0x00000417) || (ntohl(inpacket[1]) != 0x27101980) )
-    return;
-
   switch( ntohl( inpacket[2] ) ) {
     case 0: /* This is a connect action */
+      /* look for udp bittorrent magic id */
+      if( (ntohl(inpacket[0]) != 0x00000417) || (ntohl(inpacket[1]) != 0x27101980) )
+        return;
+
       outpacket[0] = 0;
       outpacket[1] = inpacket[3];
       udp_make_connectionid( outpacket + 2, remoteip );
+
       socket_send4( serversocket, static_outbuf, 16, remoteip, remoteport );
       stats_issue_event( EVENT_CONNECT, 0, 16 );
       break;
-- 
cgit v1.2.3