Skip to content

Commit

Permalink
If the remote handshake couldn't be received, ensure the connection i…
Browse files Browse the repository at this point in the history
…s correctly disposed.

svn path=/trunk/bitsharp/; revision=123693
  • Loading branch information
alanmcgovern committed Jan 17, 2009
1 parent 2b466e5 commit 918b42c
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,10 @@ private void PeerHandshakeReceived(bool succeeded, int count, object state)
{
// If the connection is closed, just return
if (!succeeded)
{
CleanupSocket(id, "Handshaking failed");
return;

}
// Decode the handshake and handle it
id.Decryptor.Decrypt(id.recieveBuffer.Array, id.recieveBuffer.Offset, count);
msg = new HandshakeMessage();
Expand Down Expand Up @@ -380,7 +382,7 @@ private void PeerHandshakeReceived(bool succeeded, int count, object state)
msg = new BitfieldMessage(id.TorrentManager.Bitfield);
}

if (id.SupportsLTMessages)
if (id.SupportsLTMessages && ClientEngine.SupportsExtended)
{
MessageBundle bundle = new MessageBundle();
bundle.Messages.Add(new ExtendedHandshakeMessage());
Expand Down

0 comments on commit 918b42c

Please sign in to comment.