/// <summary> /// Received from a <see cref="IHttpClientContext"/> when a request have been parsed successfully. /// </summary> /// <param name="source"><see cref="IHttpClientContext"/> that received the request.</param> /// <param name="args">The request.</param> private void OnRequest(object source, RequestEventArgs args) { _current = this; IHttpClientContext context = (IHttpClientContext)source; IHttpRequest request = args.Request; if (_requestQueue.ShouldQueue) { // Do not use unfinished _requestQueue: //_requestQueue.Enqueue(context, request); context.Respond("HTTP/1.0", HttpStatusCode.ServiceUnavailable, HttpStatusCode.ServiceUnavailable.ToString(), "Request Queue is full", "text/plain"); return; } ProcessRequestWrapper(context, request); // no need to lock, if all threads are busy, // someone is bound to trigger the thread correctly =) // Update: Trigger body does not (yet) have any implementation. //_requestQueue.Trigger(); }
private void OnRequestReceived(object sender, RequestEventArgs e) { RequestReceived(sender, e); }