IEnumerable RunHooks (Delegate list) { Delegate [] delegates = list.GetInvocationList (); foreach (EventHandler d in delegates){ if (d.Target != null && (d.Target is AsyncInvoker)){ current_ai = (AsyncInvoker) d.Target; try { must_yield = true; in_begin = true; context.BeginTimeoutPossible (); current_ai.begin (this, EventArgs.Empty, async_callback_completed_cb, current_ai.data); } catch (ThreadAbortException taex){ object obj = taex.ExceptionState; Thread.ResetAbort (); stop_processing = true; if (obj is StepTimeout) ProcessError (new HttpException ("The request timed out.")); } catch (Exception e){ ProcessError (e); } finally { in_begin = false; context.EndTimeoutPossible (); } // // If things are still moving forward, yield this // thread now // if (must_yield) yield return stop_processing; else if (stop_processing) yield return true; } else { try { context.BeginTimeoutPossible (); d (this, EventArgs.Empty); } catch (ThreadAbortException taex){ object obj = taex.ExceptionState; Thread.ResetAbort (); stop_processing = true; if (obj is StepTimeout) ProcessError (new HttpException ("The request timed out.")); } catch (Exception e){ ProcessError (e); } finally { context.EndTimeoutPossible (); } if (stop_processing) yield return true; } } }
// // Invoked at the end of the pipeline execution // void PipelineDone () { try { if (EndRequest != null) EndRequest (this, EventArgs.Empty); } catch (Exception e){ ProcessError (e); } try { OutputPage (); } catch (Exception e) { Console.WriteLine ("Internal error: OutputPage threw an exception " + e); } finally { context.WorkerRequest.EndOfRequest(); if (begin_iar != null){ try { begin_iar.Complete (); } catch { // // TODO: if this throws an error, we have no way of reporting it // Not really too bad, since the only failure might be // `HttpRuntime.request_processed' // } } done.Set (); if (factory != null && context.Handler != null){ factory.ReleaseHandler (context.Handler); factory = null; } context.Handler = null; // context = null; -> moved to PostDone pipeline = null; current_ai = null; } PostDone (); }
public void AddOnReleaseRequestStateAsync (BeginEventHandler bh, EndEventHandler eh, object data) { AsyncInvoker invoker = new AsyncInvoker (bh, eh, data); ReleaseRequestState += new EventHandler (invoker.Invoke); }
public void AddOnUpdateRequestCacheAsync (BeginEventHandler bh, EndEventHandler eh, object data) { AsyncInvoker invoker = new AsyncInvoker (bh, eh, data); UpdateRequestCache += new EventHandler (invoker.Invoke); }
public void AddOnEndRequestAsync (BeginEventHandler bh, EndEventHandler eh, object data) { AsyncInvoker invoker = new AsyncInvoker (bh, eh, data); EndRequest += new EventHandler (invoker.Invoke); }
public void AddOnPreRequestHandlerExecuteAsync (BeginEventHandler bh, EndEventHandler eh, object data) { AsyncInvoker invoker = new AsyncInvoker (bh, eh, data); PreRequestHandlerExecute += new EventHandler (invoker.Invoke); }
public void AddOnPostMapRequestHandlerAsync (BeginEventHandler bh, EndEventHandler eh, object data) { AsyncInvoker invoker = new AsyncInvoker (bh, eh, data); PostMapRequestHandler += new EventHandler (invoker.Invoke); }
public void AddOnResolveRequestCacheAsync (BeginEventHandler bh, EndEventHandler eh) { AsyncInvoker invoker = new AsyncInvoker (bh, eh); ResolveRequestCache += new EventHandler (invoker.Invoke); }
public void AddOnPostRequestHandlerExecuteAsync (BeginEventHandler bh, EndEventHandler eh) { AsyncInvoker invoker = new AsyncInvoker (bh, eh); PostRequestHandlerExecute += new EventHandler (invoker.Invoke); }
public void AddOnBeginRequestAsync (BeginEventHandler bh, EndEventHandler eh) { AsyncInvoker invoker = new AsyncInvoker (bh, eh); BeginRequest += new EventHandler (invoker.Invoke); }
public void AddOnAcquireRequestStateAsync (BeginEventHandler bh, EndEventHandler eh) { AsyncInvoker invoker = new AsyncInvoker (bh, eh); AcquireRequestState += new EventHandler (invoker.Invoke); }