From 61b10196e0938d931e80f691d41735f78eba8267 Mon Sep 17 00:00:00 2001 From: CaS Date: Wed, 22 Sep 2004 19:49:02 +0000 Subject: [PATCH] Don't count connections/requests from quiet hosts git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@20110 72102866-910b-0410-8b05-ffd578937521 --- WebServer.h | 5 ++++- WebServer.m | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/WebServer.h b/WebServer.h index 5ad8697..7479640 100644 --- a/WebServer.h +++ b/WebServer.h @@ -141,7 +141,10 @@ * An array of host IP addresses to refrain from logging ... * this is useful if (for instance) you have a monitoring process which * sends requests to the server to be sure it's alive, and don't want - * to log all the connections from this monitor. + * to log all the connections from this monitor.
+ * Not only do we refrain from logging anything but exceptional events + * about these hosts, connections and requests by these hosts are not + * counted in statistics we generate. *
* */ diff --git a/WebServer.m b/WebServer.m index 50f3ffa..c4b5aa5 100644 --- a/WebServer.m +++ b/WebServer.m @@ -1174,9 +1174,13 @@ unescapeData(const unsigned char* bytes, unsigned length, unsigned char *buf) { NSFileHandle *hdl = [session handle]; - if (_verbose == YES && [_quiet containsObject: [session address]] == NO) + if ([_quiet containsObject: [session address]] == NO) { - NSLog(@"%@ disconnect", session); + if (_verbose == YES) + { + NSLog(@"%@ disconnect", session); + } + _handled++; } [_nc removeObserver: self name: NSFileHandleReadCompletionNotification @@ -1192,7 +1196,6 @@ unescapeData(const unsigned char* bytes, unsigned length, unsigned char *buf) [_listener acceptConnectionInBackgroundAndNotify]; _accepting = YES; } - _handled++; } - (void) _process: (WebServerSession*)session @@ -1210,8 +1213,6 @@ unescapeData(const unsigned char* bytes, unsigned length, unsigned char *buf) NSEnumerator *enumerator; GSMimeHeader *hdr; - _requests++; - AUTORELEASE(RETAIN(session)); request = [[session parser] mimeDocument]; @@ -1244,9 +1245,13 @@ unescapeData(const unsigned char* bytes, unsigned length, unsigned char *buf) response = AUTORELEASE([GSMimeDocument new]); [response setContent: [NSData data] type: @"text/plain" name: nil]; - if (_verbose == YES && [_quiet containsObject: [session address]] == NO) + if ([_quiet containsObject: [session address]] == NO) { - NSLog(@"Request %@ - %@", session, request); + _requests++; + if (_verbose == YES) + { + NSLog(@"Request %@ - %@", session, request); + } } NS_DURING {