public void LogApplicationError(Exception e, RequestInfo req) { ApplicationError = e; RequestInfo = req; }
public void LogConnectionClosedAbruptly(Socket s, RequestInfo req) { if (string.IsNullOrEmpty(req.RelativePath)) ConnectionClosedAbruptlyWithoutUrl = true; RequestInfo = req; }
public void LogConnectionEndedNormally(Socket s, RequestInfo req) { foreach (var logger in Loggers) logger.LogConnectionEndedNormally(s, req); }
public void LogConnectionEndedNormally(Socket s, RequestInfo req) { ConnectionClosedNormally = true; RequestInfo = req; }
public void LogConnectionClosedAbruptly(Socket s, RequestInfo req) { foreach (var logger in Loggers) logger.LogConnectionClosedAbruptly(s, req); }
public void LogApplicationError(Exception e, RequestInfo req) { foreach (var logger in Loggers) logger.LogApplicationError(e, req); }
public void LogConnectionEndedNormally(Socket s, RequestInfo req) { try { var now = Now; TimeSpan requestTime; lock (connectionReceivedLock) { ConcurrentConnectionsNow--; // Stop the watch requestTime = StopConnectionTimer(s); } if (req.ResponseStatusCode != 200 && req.ResponseStatusCode != 301) return; // Look for the times with our method // We could do with a global lock here, but that just sounds so bad. // Instead, we try to avoid a global lock as much as possible, and count on another method // to give us a finer grained lock. LinkedList<RequestTimes> timesForEndpoint; lock (CreateAndReturnRelativePathLock(req.RelativePath, out timesForEndpoint)) { var verbTimes = timesForEndpoint.FirstOrDefault(t => t.HttpMethod == req.HttpMethod); if (verbTimes == null) { // First request to this endpoint with this method. Add it. verbTimes = new RequestTimes(req.HttpMethod, req.RelativePath, requestTime); timesForEndpoint.AddLast(verbTimes); } else { // Just update the times if (verbTimes.MinimumTime > requestTime) verbTimes.MinimumTime = requestTime; if (verbTimes.MaximumTime < requestTime) verbTimes.MaximumTime = requestTime; verbTimes.AverageTime = new TimeSpan((verbTimes.NumRequests * verbTimes.AverageTime.Ticks + requestTime.Ticks) / (verbTimes.NumRequests + 1)); verbTimes.NumRequests++; } } } catch { } }
public void LogConnectionClosedAbruptly(Socket s, RequestInfo req) { try { StopConnectionTimer(s); lock (abruptClosingLock) { AbruptConnectionCloses++; } } catch { } }
public void LogApplicationError(Exception e, RequestInfo req) { lock (applicationErrorsLock) { ApplicationErrors.AddLast(new ApplicationError(req.HttpMethod, req.RelativePath, e)); } }