Author: alanmc
Date: 2008-01-30 14:43:45 -0500 (Wed, 30 Jan 2008)
New Revision: 94411

Modified:
   
trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Messages/PeerMessages/HandshakeMessage.cs
Log:
Bugfixed decoding, minor other misc fixes

Modified: 
trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Messages/PeerMessages/HandshakeMessage.cs
===================================================================
--- 
trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Messages/PeerMessages/HandshakeMessage.cs
 2008-01-30 19:43:26 UTC (rev 94410)
+++ 
trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Messages/PeerMessages/HandshakeMessage.cs
 2008-01-30 19:43:45 UTC (rev 94411)
@@ -100,6 +100,7 @@
         /// </summary>
         public HandshakeMessage()
         {
+            this.supportsFastPeer = ClientEngine.SupportsFastPeer;
         }
 
 
@@ -116,6 +117,7 @@
             this.peerId = peerId;
             this.protocolString = protocolString;
             this.protocolStringLength = protocolString.Length;
+            this.supportsFastPeer = ClientEngine.SupportsFastPeer;
         }
         #endregion
 
@@ -148,12 +150,12 @@
             System.Text.Encoding.ASCII.GetBytes(peerId, 0, peerId.Length, 
buffer, i);
             i += System.Text.Encoding.ASCII.GetByteCount(peerId);
 
-            return ByteLength;
+            return i - offset;
         }
 
         public override void Decode(byte[] buffer, int offset, int length)
         {
-            int i = 0;
+            int i = offset;
             protocolStringLength = (int)buffer[i];                  // First 
byte is length
 
             // #warning Fix this hack - is there a better way of verifying the 
protocol string? Hack
@@ -273,7 +275,8 @@
                 return false;
 
             return (this.peerId == msg.peerId
-                    && this.protocolString == msg.protocolString);
+                    && this.protocolString == msg.protocolString
+                    && this.supportsFastPeer == msg.supportsFastPeer);
         }
 
 

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

Reply via email to