コード例 #1
0
 public void LogApplicationError(Exception e, RequestInfo req)
 {
     ApplicationError = e;
     RequestInfo = req;
 }
コード例 #2
0
        public void LogConnectionClosedAbruptly(Socket s, RequestInfo req)
        {
            if (string.IsNullOrEmpty(req.RelativePath))
                ConnectionClosedAbruptlyWithoutUrl = true;

            RequestInfo = req;
        }
コード例 #3
0
 public void LogConnectionEndedNormally(Socket s, RequestInfo req)
 {
     foreach (var logger in Loggers)
         logger.LogConnectionEndedNormally(s, req);
 }
コード例 #4
0
 public void LogConnectionEndedNormally(Socket s, RequestInfo req)
 {
     ConnectionClosedNormally = true;
     RequestInfo = req;
 }
コード例 #5
0
 public void LogConnectionClosedAbruptly(Socket s, RequestInfo req)
 {
     foreach (var logger in Loggers)
         logger.LogConnectionClosedAbruptly(s, req);
 }
コード例 #6
0
 public void LogApplicationError(Exception e, RequestInfo req)
 {
     foreach (var logger in Loggers)
         logger.LogApplicationError(e, req);
 }
コード例 #7
0
ファイル: StatsLogger.cs プロジェクト: knocte/Fos
        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
            {
            }
        }
コード例 #8
0
ファイル: StatsLogger.cs プロジェクト: knocte/Fos
        public void LogConnectionClosedAbruptly(Socket s, RequestInfo req)
        {
            try
            {
                StopConnectionTimer(s);

                lock (abruptClosingLock)
                {
                    AbruptConnectionCloses++;
                }
            }
            catch
            {
            }
        }
コード例 #9
0
ファイル: StatsLogger.cs プロジェクト: knocte/Fos
 public void LogApplicationError(Exception e, RequestInfo req)
 {
     lock (applicationErrorsLock)
     {
         ApplicationErrors.AddLast(new ApplicationError(req.HttpMethod, req.RelativePath, e));
     }
 }