private void BeginProcessRequest(IAsyncResult asyncResult)
        {
            try
            {
                _stream.EndWaitForConnection(asyncResult);
            }
            catch
            {
                return;
            }
            ProcessRequestHandler handler = ProcessRequest;

            if (handler != null)
            {
                handler(_stream);
            }
            if (_stream.IsConnected)
            {
                _stream.Disconnect();
                _stream.BeginWaitForConnection(BeginProcessRequest, null);
            }
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RequestQueue"/> class.
 /// </summary>
 /// <param name="handler">Called when a request should be processed.</param>
 public RequestQueue(ProcessRequestHandler handler)
 {
     _handler = handler;
 }
Example #3
0
 public static void Link <I, O>(ref ProcessRequestHandler <I, O> requester, GetProcessInstance <I, O> getProcess)
 {
     requester = (s, e) => ProcessRequestHandler(getProcess, s, (ProcessRequestEventArgs <I, O>)e);
 }
Example #4
0
 //---------------------------------------------------------------------
 // Member Functions
 //---------------------------------------------------------------------
 /// <summary>
 /// Begins processing the request asynchronously
 /// </summary>
 /// <param name="context">ASP.NET context instance</param>
 /// <param name="callback">Async callback function</param>
 /// <param name="extraData">Async callback state object</param>
 /// <returns></returns>
 public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback callback, object extraData)
 {
     m_delegate = new ProcessRequestHandler(ProcessRequest);
     return m_delegate.BeginInvoke(context, callback, extraData);
 }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RequestQueue"/> class.
 /// </summary>
 /// <param name="handler">Called when a request should be processed.</param>
 public RequestQueue(ProcessRequestHandler handler)
 {
   _handler = handler;
 }