public void Disconnect() { if (heartbeat != null) heartbeat.Dispose(); Connected = false; Disconnected(); context.FinalizeResponse(); }
private void FinalizeRequestProcessing(IHttpContext ctx, Stopwatch sw, bool ravenUiRequest) { LogHttpRequestStatsParams logHttpRequestStatsParam = null; try { logHttpRequestStatsParam = new LogHttpRequestStatsParams( sw, ctx.Request.Headers, ctx.Request.HttpMethod, ctx.Response.StatusCode, ctx.Request.Url.PathAndQuery); } catch (Exception e) { logger.WarnException("Could not gather information to log request stats", e); } ctx.FinalizeResponse(); if (ravenUiRequest || logHttpRequestStatsParam == null || sw == null) return; sw.Stop(); LogHttpRequestStats(logHttpRequestStatsParam); ctx.OutputSavedLogItems(logger); }
public void HandleActualRequest(IHttpContext ctx) { var isReadLockHeld = disposerLock.IsReadLockHeld; if (isReadLockHeld == false) { if (disposerLock.TryEnterReadLock(TimeSpan.FromSeconds(10)) == false) { ctx.SetStatusToNotAvailable(); ctx.FinalizeResponse(); logger.Warn("Could not enter disposer lock, probably disposing server, aborting request"); return; } } try { if (disposed) return; var sw = Stopwatch.StartNew(); bool ravenUiRequest = false; try { ravenUiRequest = DispatchRequest(ctx); } catch (Exception e) { ExceptionHandler.TryHandleException(ctx, e); if (ShouldLogException(e)) logger.WarnException("Error on request", e); } finally { try { FinalizeRequestProcessing(ctx, sw, ravenUiRequest); } catch (Exception e) { logger.ErrorException("Could not finalize request properly", e); } } } finally { if (isReadLockHeld == false) disposerLock.ExitReadLock(); } }