From 70233d937f445f61295d90d004feb66d0a507dbc Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Sat, 19 Apr 2008 22:48:06 +0000 Subject: [PATCH] * Start catching rogue SocketExceptions which occur (at least on mono) when a response stream for a request which actually required no response, is closed --- OpenSim/Framework/Servers/BaseHttpServer.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index de15923f2d..00c81c8149 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -199,6 +199,16 @@ namespace OpenSim.Framework.Servers } } } + catch (System.Net.Sockets.SocketException e) + { + // At least on linux, it appears that if the client makes a request without requiring the response, + // an unconnected socket exception is thrown when we close the response output stream. There's no + // obvious way to tell if the client didn't require the response, so instead we'll catch and ignore + // the exception instead. + // + // An alternative may be to turn off all response write exceptions on the HttpListener, but let's go + // with the minimum first + } catch (Exception e) { m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e);