From 99e5bbf3b087958d852dc463507cc29b95cabfba Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 18 Jun 2013 01:40:00 -0400 Subject: [PATCH] Use the correct socket for CFStreamCreatePairWithSocket. And some minor message passing cleanup. --- Source/MessageQueue.m | 4 +++- Source/NetworkConnection.mm | 8 ++------ Source/ProtocolClient.m | 1 + 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Source/MessageQueue.m b/Source/MessageQueue.m index 7f533b4..b4c706d 100644 --- a/Source/MessageQueue.m +++ b/Source/MessageQueue.m @@ -329,9 +329,11 @@ static void MessageQueueWriteEvent(CFWriteStreamRef stream, return; } + _child = child; + // Create the streams on the socket. CFStreamCreatePairWithSocket(kCFAllocatorDefault, - socket, // Socket handle. + _child, // Socket handle. &_readStream, // Read stream in-pointer. &_writeStream); // Write stream in-pointer. diff --git a/Source/NetworkConnection.mm b/Source/NetworkConnection.mm index 0bd3f99..3530729 100644 --- a/Source/NetworkConnection.mm +++ b/Source/NetworkConnection.mm @@ -161,16 +161,12 @@ if ([[[response rootElement] name] isEqualToString:@"init"]) { connected_ = YES; - [delegate_ performSelectorOnMainThread:@selector(handleInitialResponse:) - withObject:response - waitUntilDone:NO]; + [delegate_ handleInitialResponse:response]; return; } if ([delegate_ respondsToSelector:@selector(handleResponse:)]) - [delegate_ performSelectorOnMainThread:@selector(handleResponse:) - withObject:response - waitUntilDone:NO]; + [delegate_ handleResponse:response]; } @end diff --git a/Source/ProtocolClient.m b/Source/ProtocolClient.m index f8d386c..ba1fa7e 100644 --- a/Source/ProtocolClient.m +++ b/Source/ProtocolClient.m @@ -60,6 +60,7 @@ NSNumber* callbackKey = [NSNumber numberWithInt:_nextID++]; NSString* taggedCommand = [NSString stringWithFormat:@"%@ -i %@", [command autorelease], callbackKey]; + assert(_messageQueue); [_messageQueue sendMessage:taggedCommand]; return callbackKey; } -- 2.43.5