diff --git a/MCGalaxy/Modules/Relay/Discord/DiscordWebsocket.cs b/MCGalaxy/Modules/Relay/Discord/DiscordWebsocket.cs index 74ca2a5a7..400d6be77 100644 --- a/MCGalaxy/Modules/Relay/Discord/DiscordWebsocket.cs +++ b/MCGalaxy/Modules/Relay/Discord/DiscordWebsocket.cs @@ -116,7 +116,7 @@ namespace MCGalaxy.Modules.Relay.Discord { byte[] data = new byte[4096]; for (;;) { int len = stream.Read(data, 0, 4096); - if (len == 0) throw new EndOfStreamException("stream.Read returned 0"); + if (len == 0) throw new IOException("stream.Read returned 0"); HandleReceived(data, len); } diff --git a/MCGalaxy/Modules/Relay/RelayBot.cs b/MCGalaxy/Modules/Relay/RelayBot.cs index 02ec951a2..7a53a3a76 100644 --- a/MCGalaxy/Modules/Relay/RelayBot.cs +++ b/MCGalaxy/Modules/Relay/RelayBot.cs @@ -156,7 +156,10 @@ namespace MCGalaxy.Modules.Relay { // SocketException is usually due to complete connection dropout retries = 0; Thread.Sleep(30 * 1000); - } catch (Exception ex) { + } catch (IOException ex) { + // IOException is an expected error, so don't log full details + Logger.Log(LogType.Warning, "{0} read error ({1})", RelayName, ex.Message); + } catch (Exception ex) { Logger.LogError(RelayName + " relay error", ex); } retries++; diff --git a/MCGalaxy/sharkbite.thresher/Connection.cs b/MCGalaxy/sharkbite.thresher/Connection.cs index f3834bd4b..098255614 100644 --- a/MCGalaxy/sharkbite.thresher/Connection.cs +++ b/MCGalaxy/sharkbite.thresher/Connection.cs @@ -192,23 +192,13 @@ namespace Sharkbite.Irc } } } - catch (IOException) - { - //Trap a connection failure - listener.Error( ReplyCode.ConnectionFailed, "Connection to server unexpectedly failed."); - } - catch (Exception ex) - { - listener.Error( ReplyCode.ConnectionFailed, "Unhandled error: " + ex); - } finally { //The connection to the IRC server has been closed either //by client request or the server itself closed the connection. client.Close(); registered = false; - connected = false; - listener.Disconnected(); + connected = false; } } /// diff --git a/MCGalaxy/sharkbite.thresher/Listener.cs b/MCGalaxy/sharkbite.thresher/Listener.cs index a379ab904..4d2f235c3 100644 --- a/MCGalaxy/sharkbite.thresher/Listener.cs +++ b/MCGalaxy/sharkbite.thresher/Listener.cs @@ -77,10 +77,6 @@ namespace Sharkbite.Irc /// public event RegisteredEventHandler OnRegistered; /// - /// This connection has been closed. - /// - public event DisconnectedEventHandler OnDisconnected; - /// /// A Notice type message was sent to a channel. /// public event PublicNoticeEventHandler OnPublicNotice; @@ -204,16 +200,6 @@ namespace Sharkbite.Irc } } /// - /// Tell listeners that this connection is closed - /// - internal void Disconnected() - { - if( OnDisconnected != null ) - { - OnDisconnected(); - } - } - /// /// Tell listeners that an error has been encountered /// internal void Error( ReplyCode code, string message ) diff --git a/MCGalaxy/sharkbite.thresher/ReplyCode.cs b/MCGalaxy/sharkbite.thresher/ReplyCode.cs index 53c3248dd..fdecd4290 100644 --- a/MCGalaxy/sharkbite.thresher/ReplyCode.cs +++ b/MCGalaxy/sharkbite.thresher/ReplyCode.cs @@ -118,11 +118,6 @@ namespace Sharkbite.Irc /// ERR_USERSDONTMATCH = 502, - /// - /// When the TCP/IP connection unexpectedly fails. - /// - ConnectionFailed = 1000, - /// /// The IRC server sent an 'ERROR' message for some /// reason.