internal void ServiceRequest(object state)
{
IMessage message;
ITransportHeaders headers2;
Stream stream2;
HttpServerSocketHandler handler = (HttpServerSocketHandler) state;
ITransportHeaders requestHeaders = handler.ReadHeaders();
Stream requestStream = handler.GetRequestStream();
requestHeaders["__CustomErrorsEnabled"] = handler.CustomErrorsEnabled();
ServerChannelSinkStack sinkStack = new ServerChannelSinkStack();
sinkStack.Push(this, handler);
ServerProcessing processing = this._nextSink.ProcessMessage(sinkStack, null, requestHeaders, requestStream, out message, out headers2, out stream2);
switch (processing)
{
case ServerProcessing.Complete:
sinkStack.Pop(this);
handler.SendResponse(stream2, "200", "OK", headers2);
break;
case ServerProcessing.OneWay:
handler.SendResponse(null, "202", "Accepted", headers2);
break;
case ServerProcessing.Async:
sinkStack.StoreAndDispatch(this, handler);
break;
}
if (processing != ServerProcessing.Async)
{
if (handler.CanServiceAnotherRequest())
{
handler.BeginReadMessage();
}
else
{
handler.Close();
}
}
}