Author: alanmc
Date: 2007-03-31 11:33:33 -0500 (Sat, 31 Mar 2007)
New Revision: 75240

Modified:
   trunk/bitsharp/src/MonoTorrent.Client/Managers/ConnectionManager.cs
Log:
Should correctly disconnect peers once the limit has been reached

Modified: trunk/bitsharp/src/MonoTorrent.Client/Managers/ConnectionManager.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent.Client/Managers/ConnectionManager.cs 
2007-03-31 12:32:38 UTC (rev 75239)
+++ trunk/bitsharp/src/MonoTorrent.Client/Managers/ConnectionManager.cs 
2007-03-31 16:33:33 UTC (rev 75240)
@@ -805,7 +805,7 @@
         /// <param name="id">The peer whose connection needs to be 
closed</param>
         internal void CleanupSocket(PeerConnectionID id, string message)
         {
-            CleanupSocket(id, false, message);
+            CleanupSocket(id, true, message);
         }
 
 
@@ -946,6 +946,12 @@
                         if (this.PeerConnected != null)
                             this.PeerConnected(null, new 
PeerConnectionEventArgs(id, Direction.Incoming));
 
+                                               if ((this.openConnections >= 
this.MaxOpenConnections))
+                                               {
+                                                       reason = "Too many 
peers";
+                                                       cleanUp = true;
+                                                       return;
+                                               }
                         Logger.Log(id, "Recieving message length");
                         ClientEngine.ConnectionManager.ReceiveMessage(id, 4, 
this.messageLengthReceivedCallback);
                     }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to