Skip to content

Commit

Permalink
add mono check
Browse files Browse the repository at this point in the history
  • Loading branch information
LukePulverenti committed Oct 8, 2014
1 parent 7700f00 commit b187168
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class HttpListenerServer : IHttpListener
public Func<IHttpRequest, Uri, Task> RequestHandler { get; set; }

private readonly Action<string> _endpointListener;

public HttpListenerServer(ILogger logger, Action<string> endpointListener)
{
_logger = logger;
Expand Down Expand Up @@ -84,7 +84,7 @@ private void Listen()
private void ListenerCallback(IAsyncResult asyncResult)
{
_listenForNextRequest.Set();

var listener = asyncResult.AsyncState as HttpListener;
HttpListenerContext context;

Expand Down Expand Up @@ -161,6 +161,7 @@ private Task ProcessRequestAsync(HttpListenerContext context)
/// <returns>Task.</returns>
private async Task ProcessWebSocketRequest(HttpListenerContext ctx)
{
#if !__MonoCS__
try
{
var webSocketContext = await ctx.AcceptWebSocketAsync(null).ConfigureAwait(false);
Expand All @@ -180,13 +181,14 @@ private async Task ProcessWebSocketRequest(HttpListenerContext ctx)
ctx.Response.StatusCode = 500;
ctx.Response.Close();
}
#endif
}

private void HandleError(Exception ex, HttpListenerContext context)
{
var operationName = context.Request.GetOperationName();
var httpReq = GetRequest(context, operationName);

if (ErrorHandler != null)
{
ErrorHandler(ex, httpReq);
Expand Down Expand Up @@ -280,4 +282,4 @@ protected virtual void Dispose(bool disposing)
}
}
}
}
}

0 comments on commit b187168

Please sign in to comment.