本文整理汇总了C#中RequestInfo.Processed方法的典型用法代码示例。如果您正苦于以下问题:C# RequestInfo.Processed方法的具体用法?C# RequestInfo.Processed怎么用?C# RequestInfo.Processed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RequestInfo
的用法示例。
在下文中一共展示了RequestInfo.Processed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessAllMessages
private void ProcessAllMessages(RequestInfo request, HttpSocketContext ctx, IPrincipal principal, ManualResetEvent resetEvent, bool canReschedule)
{
RouteMatch? routeMatch;
RouteHandler route;
var socket = request.Socket;
while (ctx.Parse(socket, out routeMatch, out route))
{
var match = routeMatch.Value;
var auth = Authentication.TryAuthorize(ctx.GetRequestHeader("authorization"), ctx.RawUrl, route);
if (auth.Principal != null)
{
if (canReschedule && route.IsAsync)
{
resetEvent.Reset();
ThreadPool.QueueUserWorkItem(ProcessInThread, new ThreadArgs(request, ctx, resetEvent, auth, route, match));
Thread.Yield();
resetEvent.WaitOne();
return;
}
else
{
ctx.ForRouteWithAuth(match, auth.Principal);
if (principal != auth.Principal)
Thread.CurrentPrincipal = principal = auth.Principal;
using (var stream = route.Handle(match.OrderedArgs, ctx, ctx, ctx.InputStream, ctx.OutputStream))
{
var keepAlive = ctx.Return(stream, socket, !canReschedule);
if (keepAlive)
{
if (ctx.Pipeline) continue;
else if (socket.Connected && Requests.TryAdd(request.Processed())) return;
}
socket.Close();
return;
}
}
}
else
{
CheckAuth(socket, auth, ctx);
return;
}
}
}