Пример #1
0
        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);
            }
        }
Пример #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;
 }
Пример #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);
 }
Пример #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);
 }
Пример #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;
 }