=== modified file 'beagled/Server.cs' --- beagled/Server.cs +++ beagled/Server.cs @@ -127,22 +127,17 @@ this.executor.Cleanup (); this.executor.AsyncResponseEvent -= OnAsyncResponse; } + + Logger.Log.Debug ("httpserver: closing connection"); } public void WatchCallback (IAsyncResult ar) { int bytes_read = 0; - try { - bytes_read = this.context.Request.InputStream.EndRead (ar); - } catch (SocketException) { - } catch (IOException) { } - - if (bytes_read == 0) { - Close (); - } - else - SetupWatch (); + bytes_read = this.context.Request.InputStream.EndRead (ar); + + SetupWatch (); } public override void SetupWatch () @@ -158,27 +153,35 @@ public override bool SendResponse (ResponseMessage response) { - - bool r = false; - - lock (this.client_lock) { - if (this.context == null) { - return false; - } - r = SendResponse (response, context.Response.OutputStream); - } - - if (r) { - Logger.Log.Debug ("httpserver: Sent response = " + response.ToString () ); - //add end-of-document - context.Response.OutputStream.WriteByte(0xff); - context.Response.OutputStream.Flush (); - } - else - Logger.Log.Debug ("httpserver: Failed to send response = " + response.ToString () ); - return r; - } - + try { + + bool r = false; + + lock (this.client_lock) { + if (this.context == null) { + return false; + } + r = SendResponse (response, context.Response.OutputStream); + } + + if (r) { + Logger.Log.Debug ("httpserver: Sent response = " + response.ToString () ); + //add end-of-document + context.Response.OutputStream.WriteByte(0xff); + context.Response.OutputStream.Flush (); + } + else + Logger.Log.Debug ("httpserver: Failed to send response = " + response.ToString () ); + return r; + } + + catch (Exception) + { + Logger.Log.Warn("APEPEPEPE"); + return false; + } + + } } class UnixConnectionHandler : ConnectionHandler {