[Flickrkit-svn] r488 - in branches/FlickrKit-iPhoneXML/Tests/TestHarness/Toxic: HTTP Networking

fraser at speirs.org fraser at speirs.org
Wed Mar 26 20:13:08 UTC 2008


Author: fspeirs
Date: 2008-03-26 20:13:03 +0000 (Wed, 26 Mar 2008)
New Revision: 488

Modified:
   branches/FlickrKit-iPhoneXML/Tests/TestHarness/Toxic/HTTP/CHTTPMessageProcessor.m
   branches/FlickrKit-iPhoneXML/Tests/TestHarness/Toxic/HTTP/CHTTPRemoteServer.m
   branches/FlickrKit-iPhoneXML/Tests/TestHarness/Toxic/HTTP/CHTTPRequestHandler.m
   branches/FlickrKit-iPhoneXML/Tests/TestHarness/Toxic/Networking/CSocket.m
   branches/FlickrKit-iPhoneXML/Tests/TestHarness/Toxic/Networking/CSocketServer.m
Log:
Made the Toxic HTTPServer stuff a bit less chatty

Modified: branches/FlickrKit-iPhoneXML/Tests/TestHarness/Toxic/HTTP/CHTTPMessageProcessor.m
===================================================================
--- branches/FlickrKit-iPhoneXML/Tests/TestHarness/Toxic/HTTP/CHTTPMessageProcessor.m	2008-03-26 20:12:37 UTC (rev 487)
+++ branches/FlickrKit-iPhoneXML/Tests/TestHarness/Toxic/HTTP/CHTTPMessageProcessor.m	2008-03-26 20:13:03 UTC (rev 488)
@@ -67,28 +67,28 @@
 NSString *theString = NULL;
 do
     {
-    NSLog(@"http -- Reading header.");
+    //NSLog(@"http -- Reading header.");
     theString = [inSocket readCRLFString];
     [self processLine:theString];
     }
 while (theString != NULL && ![self processedHeaders]);
-NSLog(@"http -- Headers processed.");
+//NSLog(@"http -- Headers processed.");
 //
 NSAssert(httpMessage != NULL, @"httpMessage is NULL");
 if ([httpMessage hasEntity] == YES)
     {
-	NSLog(@"http -- Reading entity.");
+	//NSLog(@"http -- Reading entity.");
 
 	if ([[[httpMessage entity] headers] hasHeader:@"Content-Length"])
 		{
 		const int theContentLength = [[[[httpMessage entity] headers] getHeader:@"Content-Length"] intValue];
-		NSLog(@"http -- Reading next %d octets as entity data.", theContentLength);
+		//NSLog(@"http -- Reading next %d octets as entity data.", theContentLength);
 		[self processData:[(CSocket *)inSocket readDataOfLength:theContentLength]];
 		}
 	else
 		[self processData:[inSocket readData]];
     }
-NSLog(@"http -- Entire socket processed!");
+//NSLog(@"http -- Entire socket processed!");
 }
 
 - (void)processLine:(NSString *)inLine
@@ -105,7 +105,7 @@
 NSString *theLine = inLine;
 if ([theLine hasSuffix: @"\r\n"])
 	theLine = [theLine substringToIndex:[theLine length] - 2];
-NSLog(@"http -- Processing request/response line:(%@).", theLine);
+//NSLog(@"http -- Processing request/response line:(%@).", theLine);
 if ([theLine length] > 0)
     {
     NSAssert(httpMessage != NULL, @"httpMessage is NULL");
@@ -118,11 +118,11 @@
 NSString *theLine = inLine;
 if ([theLine hasSuffix: @"\r\n"])
 	theLine = [theLine substringToIndex:[theLine length] - 2];
-NSLog(@"http -- Processing header line:(%@).", theLine);
+//NSLog(@"http -- Processing header line:(%@).", theLine);
 
 if ([theLine length] == 0)
 	{
-	NSLog(@"http -- Empty line processed, must be at end of headers");
+	//NSLog(@"http -- Empty line processed, must be at end of headers");
 	processedHeaders = YES;
 	}
 else if ([theLine hasSuffix:@"\t"])

Modified: branches/FlickrKit-iPhoneXML/Tests/TestHarness/Toxic/HTTP/CHTTPRemoteServer.m
===================================================================
--- branches/FlickrKit-iPhoneXML/Tests/TestHarness/Toxic/HTTP/CHTTPRemoteServer.m	2008-03-26 20:12:37 UTC (rev 487)
+++ branches/FlickrKit-iPhoneXML/Tests/TestHarness/Toxic/HTTP/CHTTPRemoteServer.m	2008-03-26 20:13:03 UTC (rev 488)
@@ -65,17 +65,17 @@
 CHTTPResponseProcessor *theHTTPResponseProcessor = NULL;
 id theSocket = NULL;
 
-NSLog(@"http -- Creating response processor.");
+//NSLog(@"http -- Creating response processor.");
 theHTTPResponseProcessor = [[[CHTTPResponseProcessor alloc] init] autorelease];
-NSLog(@"http -- Creating socket.");
+//NSLog(@"http -- Creating socket.");
 theSocket = [[[socketClass alloc] init] autorelease];
-NSLog(@"http -- Connecting to service.");
+//NSLog(@"http -- Connecting to service.");
 [theSocket connectToAddress:[CSocketAddress socketAddressWithHost:remoteHost andPort:remotePort]];
-NSLog(@"http -- Sending request %@.", [inHTTPRequest message]);
+//NSLog(@"http -- Sending request %@.", [inHTTPRequest message]);
 [(CSocket *)theSocket writeData:[inHTTPRequest message]];
-NSLog(@"http -- Processing response.");
+//NSLog(@"http -- Processing response.");
 [theHTTPResponseProcessor processSocket:theSocket];
-NSLog(@"http -- Done.");
+//NSLog(@"http -- Done.");
 return([theHTTPResponseProcessor response]);
 }
 

Modified: branches/FlickrKit-iPhoneXML/Tests/TestHarness/Toxic/HTTP/CHTTPRequestHandler.m
===================================================================
--- branches/FlickrKit-iPhoneXML/Tests/TestHarness/Toxic/HTTP/CHTTPRequestHandler.m	2008-03-26 20:12:37 UTC (rev 487)
+++ branches/FlickrKit-iPhoneXML/Tests/TestHarness/Toxic/HTTP/CHTTPRequestHandler.m	2008-03-26 20:13:03 UTC (rev 488)
@@ -11,21 +11,21 @@
 {
 CHTTPServer *theHTTPServer = (CHTTPServer *)inSocketServer;
 //
-NSLog(@"http -- Receiving request.");
+//NSLog(@"http -- Receiving request.");
 CHTTPRequestProcessor *theRequestProcessor = [[[CHTTPRequestProcessor alloc] init] autorelease];
 [theRequestProcessor processSocket:inSocket];
 CHTTPRequest *theRequest = [theRequestProcessor request];
 //
-NSLog(@"http -- Handling request.");
+//NSLog(@"http -- Handling request.");
 CHTTPResponse *theResponse = [self handleRequest:theRequest fromServer:theHTTPServer onSocket:inSocket instanceData:inInstanceData];
 if (theResponse == NULL)
 	{
 	theResponse = [CHTTPResponse httpResponseWithStatusCode:HTTPStatusCode_InternalServerError includeEntity:NO];
 	}
 //
-NSLog(@"http -- Sending response (%@).", theResponse);
+//NSLog(@"http -- Sending response (%@).", theResponse);
 [inSocket writeData:[theResponse message]];
-NSLog(@"http -- Disconnecting.");
+//NSLog(@"http -- Disconnecting.");
 [inSocket disconnect];
 }
 

Modified: branches/FlickrKit-iPhoneXML/Tests/TestHarness/Toxic/Networking/CSocket.m
===================================================================
--- branches/FlickrKit-iPhoneXML/Tests/TestHarness/Toxic/Networking/CSocket.m	2008-03-26 20:12:37 UTC (rev 487)
+++ branches/FlickrKit-iPhoneXML/Tests/TestHarness/Toxic/Networking/CSocket.m	2008-03-26 20:13:03 UTC (rev 488)
@@ -25,7 +25,7 @@
 {
 if ((self = [super init]) != NULL)
 	{
-	NSLog(@"network -- socket 0x%x inited", self);
+	//NSLog(@"network -- socket 0x%x inited", self);
 	fileDescriptor = 0;
 	readBuffer = [[NSMutableData alloc] initWithCapacity:16384];
 	[readBuffer setLength:16384];
@@ -43,7 +43,7 @@
 {
 if (([self init]) != NULL)
 	{
-	NSLog(@"network -- Creating new socket object from descriptor.");
+	//NSLog(@"network -- Creating new socket object from descriptor.");
 	fileDescriptor = inDescriptor;
 	isBound = YES;
 	isConnected = YES;
@@ -67,7 +67,7 @@
 [remoteAddress autorelease];
 remoteAddress = NULL;
 //
-NSLog(@"network -- socket 0x%x dealloced", self);
+//NSLog(@"network -- socket 0x%x dealloced", self);
 //
 [super dealloc];
 }
@@ -156,7 +156,7 @@
 //
 if (options & SocketFlags_LingerOnClose)
 	{
-	NSLog(@"network -- Setting linger on close.");
+	//NSLog(@"network -- Setting linger on close.");
 	struct linger theOptionValue = { 1, 10 };
 	int theResultCode = setsockopt([self fileDescriptor], SOL_SOCKET, SO_LINGER, &theOptionValue, sizeof(theOptionValue));
 	if (theResultCode != 0)
@@ -166,7 +166,7 @@
 
 - (void)setSocketToReuseAddress:(BOOL)inReuse;
 {
-NSLog(@"network -- -[CSocket setSocketToReuseAddress] is deprecated. Use -[CSocket setOptions:] instead");
+//NSLog(@"network -- -[CSocket setSocketToReuseAddress] is deprecated. Use -[CSocket setOptions:] instead");
 [self setOptions:options | SocketFlags_ReuseAddresses];
 }
 
@@ -175,7 +175,7 @@
 - (void)connectToAddress:(CSocketAddress *)inAddress
 {
 // ### Create a socket.
-NSLog(@"network -- Creating socket.");
+//NSLog(@"network -- Creating socket.");
 fileDescriptor = socket(AF_INET, SOCK_STREAM, 0);
 if ([self fileDescriptor] <= 0)
 	[NSException raise:NSGenericException format:@"-[CSocket connectToAddress:] - socket() failed."];
@@ -184,7 +184,7 @@
 [self enforceOptions];
 //
 // ### Bind the socket to zero (0.0.0.0:0), and put the result of bind() into localAddress
-NSLog(@"network -- Binding socket.");
+//NSLog(@"network -- Binding socket.");
 CSocketAddress *theLocalAddress = [[[CSocketAddress alloc] init] autorelease];
 struct sockaddr_in theLocalHost, theRemoteHost;
 [theLocalAddress getSockAddr:&theLocalHost];
@@ -194,7 +194,7 @@
 isBound = YES;
 [[NSNotificationCenter defaultCenter] postNotificationName:@"socketDidBind" object:self userInfo:NULL];
 // ### connect to the remote host and set remoteAddress
-NSLog(@"network -- Connecting to remote host.");
+//NSLog(@"network -- Connecting to remote host.");
 [inAddress getSockAddr:&theRemoteHost];
 theResultCode = connect([self fileDescriptor], (const struct sockaddr *)&theRemoteHost, sizeof(theRemoteHost));
 if (theResultCode != 0)
@@ -316,7 +316,7 @@
 {
 if ([self fileDescriptor] != 0)
 	{
-	NSLog(@"network -- Disconnecting (%@).", self);
+	//NSLog(@"network -- Disconnecting (%@).", self);
 	int theResultCode = close([self fileDescriptor]);
 	if (theResultCode != 0)
 		[NSException raise:NSGenericException format:@"-[CSocket disconnect] - close() failed."];
@@ -350,14 +350,14 @@
 
 - (size_t)writeData:(NSData *)inData
 {
-NSLog(@"network -- Writing data:%@", inData);
+//NSLog(@"network -- Writing data:%@", inData);
 const size_t theBytesSent = [self writeData:[inData bytes] length:[inData length]];
 return(theBytesSent);
 }
 
 - (size_t)writeString:(NSString *)inString
 {
-NSLog(@"network -- Writing string:%@", inString);
+//NSLog(@"network -- Writing string:%@", inString);
 const size_t theBytesSent = [self writeData:[inString cString] length:[inString length]];
 return(theBytesSent);
 }
@@ -401,7 +401,7 @@
 
 - (NSString *)readCRLFString
 {
-NSLog(@"network -- readCRLFString()");
+//NSLog(@"network -- readCRLFString()");
 //
 char theCharPair[3] = { '\0', '\0', '\0' };
 size_t theBytesRead = [self readData:theCharPair length:2];

Modified: branches/FlickrKit-iPhoneXML/Tests/TestHarness/Toxic/Networking/CSocketServer.m
===================================================================
--- branches/FlickrKit-iPhoneXML/Tests/TestHarness/Toxic/Networking/CSocketServer.m	2008-03-26 20:12:37 UTC (rev 487)
+++ branches/FlickrKit-iPhoneXML/Tests/TestHarness/Toxic/Networking/CSocketServer.m	2008-03-26 20:13:03 UTC (rev 488)
@@ -61,14 +61,14 @@
 	[[self listeningSocket] setSocketToReuseAddress:YES];
 	[[self listeningSocket] setThreadSelector:@selector(spawnThread:)];
 	[[self listeningSocket] setThreadTarget:self];
-	NSLog(@"network.CSocketServer -- Listening on port (%d).", port);
+	//NSLog(@"network.CSocketServer -- Listening on port (%d).", port);
 	[[self listeningSocket] listenOnPort:port];
     while (true)
         {
 		[lock lock];
 		if ([self listeningSocket] == NULL || [[self listeningSocket] isListening] == NO)
 			break;
-		NSLog(@"network.CSocketServer -- About to accept (Thread: 0x%x)", [NSThread currentThread]);
+		//NSLog(@"network.CSocketServer -- About to accept (Thread: 0x%x)", [NSThread currentThread]);
 		[[self listeningSocket] acceptWithTimeout:acceptTimeout];
 		[lock unlock];
         }
@@ -83,7 +83,7 @@
 
 - (void)stopServing
 {
-NSLog(@"network.CSocketServer -- stopServing %@", self);
+//NSLog(@"network.CSocketServer -- stopServing %@", self);
 [lock lock];
 [[self listeningSocket] disconnect];
 [lock unlock];



More information about the Flickrkit-svn mailing list