예제 #1
0
파일: HttpServer.cs 프로젝트: redbaty/Swebs
 protected virtual void OnRequestReceived(HttpRequestEventArgs e)
 {
     foreach (HttpRequestEventHandler handler in RequestReceived.GetInvocationList())
     {
         try
         {
             handler.Invoke(this, e);
         }
         catch (Exception ex)
         {
             ex.Source = handler.Method.Module + "/" + handler.Method.DeclaringType.Name + "/" + handler.Method.Name;
             RaiseUnhandledException(e.Context, ex);
         }
     }
 }
예제 #2
0
        private bool _disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            Log.Info($"{this}:  Dispose({disposing})");

            if (!_disposedValue)
            {
                if (disposing)
                {
                    _closedCancellation.Cancel();

                    foreach (RequestReceived callback in (RequestReceived?.GetInvocationList() ?? Enumerable.Empty <Delegate>()))
                    {
                        RequestReceived -= callback;
                    }

                    _closedCancellation?.Dispose();
                }

                _disposedValue = true;
            }
        }