Author: alanmc
Date: 2008-02-02 19:49:07 -0500 (Sat, 02 Feb 2008)
New Revision: 94661
Modified:
trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Managers/ConnectionManager.cs
trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Managers/ListenManager.cs
Log:
We need to 'catch (Exception)' rather than 'catch (SocketException)' now as we
can't be sure what exceptions other people will throw.
Modified:
trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Managers/ConnectionManager.cs
===================================================================
---
trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Managers/ConnectionManager.cs
2008-02-03 00:34:51 UTC (rev 94660)
+++
trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Managers/ConnectionManager.cs
2008-02-03 00:49:07 UTC (rev 94661)
@@ -188,7 +188,7 @@
{
id.Connection.BeginConnect(this.endCreateConnectionCallback, id);
}
- catch (SocketException)
+ catch (Exception)
{
// If there's a socket exception at this point, just drop
the peer's details silently
// as they must be invalid.
@@ -232,7 +232,7 @@
}
}
- catch (SocketException ex)
+ catch (Exception ex)
{
lock (id.TorrentManager.listLock)
{
@@ -410,7 +410,7 @@
}
}
- catch (SocketException ex)
+ catch (Exception ex)
{
Logger.Log(id.Connection.Connection, "Exception recieving
message" + ex.ToString());
reason = "Socket Exception receiving";
@@ -475,18 +475,12 @@
}
}
}
- catch (SocketException)
+ catch (Exception)
{
reason = "Exception EndSending";
Logger.Log(id.Connection.Connection, "ConnectionManager -
Socket exception sending message");
cleanup = true;
}
- catch (ArgumentException ex)
- {
- reason = "FECKIN ARGUMENT EXCEPTIONS ENDSENDING!";
- cleanup = true;
- Logger.Log(id.Connection.Connection, "ConnectionManager -
ArgumentEx sending message: {0}", ex.Message);
- }
finally
{
if (cleanup)
@@ -773,7 +767,7 @@
}
}
}
- catch (SocketException)
+ catch (Exception)
{
Logger.Log(id.Connection.Connection, "ConnectionManager -
Socket error receiving message");
cleanUp = true;
@@ -818,7 +812,7 @@
id.TorrentManager.ResumePeers();
}
}
- catch (SocketException)
+ catch (Exception)
{
Logger.Log(id.Connection.Connection, "ConnectionManager -
Socket error sending message");
cleanup = true;
@@ -990,7 +984,7 @@
}
}
}
- catch (SocketException)
+ catch (Exception)
{
reason = "Exception for incoming connection";
Logger.Log(id.Connection.Connection, "Socket exception when
accepting peer");
@@ -1011,14 +1005,14 @@
//ClientEngine.BufferManager.FreeBuffer(ref
id.Connection.sendBuffer);
ReceiveMessage(id, 68, this.handshakeReceievedCallback);
}
- catch (SocketException)
- {
- CleanupSocket(id, "Exception on encryptor");
- }
catch (NullReferenceException)
{
CleanupSocket(id, "Null Ref for encryptor");
}
+ catch (Exception)
+ {
+ CleanupSocket(id, "Exception on encryptor");
+ }
}
@@ -1044,14 +1038,14 @@
if (this.engine.Settings.MinEncryptionLevel ==
EncryptionType.None)
id.TorrentManager.Peers.AddPeer(id.Peer,
PeerType.Available);*/
}
- catch (SocketException)
- {
- CleanupSocket(id, "Encryptor error");
- }
catch (NullReferenceException)
{
CleanupSocket(id, "Null ref encryptor error");
}
+ catch (Exception)
+ {
+ CleanupSocket(id, "Encryptor error");
+ }
}
@@ -1077,7 +1071,7 @@
SendMessage(id, msg, this.messageSentCallback);
Logger.Log(id.Connection.Connection, "ConnectionManager -
Sending message from queue: {0}", msg.ToString());
}
- catch (SocketException)
+ catch (Exception)
{
Logger.Log(id.Connection.Connection, "ConnectionManager -
Socket exception dequeuing message");
CleanupSocket(id, "Exception calling SendMessage");
@@ -1148,7 +1142,7 @@
return byteCount;
}
- catch (SocketException)
+ catch (Exception)
{
Logger.Log(id.Connection.Connection, "ConnectionManager -
SocketException resuming");
cleanUp = true;
Modified:
trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Managers/ListenManager.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Managers/ListenManager.cs
2008-02-03 00:34:51 UTC (rev 94660)
+++ trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Managers/ListenManager.cs
2008-02-03 00:49:07 UTC (rev 94661)
@@ -316,15 +316,14 @@
handleHandshake(id);
}
}
-
- catch (SocketException)
+ catch (NullReferenceException)
{
- Logger.Log(id.Connection.Connection, "ListenManager - Socket
exception receiving handshake");
+ Logger.Log(id.Connection.Connection, "ListenManager - Null ref
receiving handshake");
CleanupSocket(id);
}
- catch (NullReferenceException)
+ catch (Exception)
{
- Logger.Log(id.Connection.Connection, "ListenManager - Null ref
receiving handshake");
+ Logger.Log(id.Connection.Connection, "ListenManager - Socket
exception receiving handshake");
CleanupSocket(id);
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches