From 6cb5b9f36e3fd568b2fcfe291ec9f7cc5ec04ed3 Mon Sep 17 00:00:00 2001 From: Joel Fischer Date: Wed, 23 Sep 2015 13:04:27 -0400 Subject: [PATCH 01/12] Minor fixes --- SuperSocket/STCPSocket.h | 4 - SuperSocket/STCPSocket.m | 3 - SuperSocket/SUDPSendPacket.h | 25 ++-- SuperSocket/SUDPSendPacket.m | 20 ++- SuperSocket/SUDPSocket.m | 265 ++++++++++++++++++----------------- 5 files changed, 165 insertions(+), 152 deletions(-) diff --git a/SuperSocket/STCPSocket.h b/SuperSocket/STCPSocket.h index 670b957c..2be34430 100644 --- a/SuperSocket/STCPSocket.h +++ b/SuperSocket/STCPSocket.h @@ -89,11 +89,7 @@ typedef NS_ENUM(NSUInteger, STCPSocketError) { #pragma mark Configuration @property (atomic, weak, readwrite) id delegate; -#if OS_OBJECT_USE_OBJC @property (atomic, strong, readwrite) dispatch_queue_t delegateQueue; -#else -@property (atomic, assign, readwrite) dispatch_queue_t delegateQueue; -#endif - (void)getDelegate:(id *)delegatePtr delegateQueue:(dispatch_queue_t *)delegateQueuePtr; - (void)setDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue; diff --git a/SuperSocket/STCPSocket.m b/SuperSocket/STCPSocket.m index 0de3a358..d494faaa 100644 --- a/SuperSocket/STCPSocket.m +++ b/SuperSocket/STCPSocket.m @@ -2694,9 +2694,6 @@ - (void)readDataWithTimeout:(NSTimeInterval)timeout } } }); - - // Do not rely on the block being run in order to release the packet, - // as the queue might get released without the block completing. } - (void)readDataToLength:(NSUInteger)length withTimeout:(NSTimeInterval)timeout tag:(long)tag { diff --git a/SuperSocket/SUDPSendPacket.h b/SuperSocket/SUDPSendPacket.h index 59fe3364..45072766 100644 --- a/SuperSocket/SUDPSendPacket.h +++ b/SuperSocket/SUDPSendPacket.h @@ -11,22 +11,19 @@ /** * The GCDAsyncUdpSendPacket encompasses the instructions for a single send/write. **/ -@interface SUDPSendPacket : NSObject { - @public - NSData *buffer; - NSTimeInterval timeout; - long tag; +@interface SUDPSendPacket : NSObject - BOOL resolveInProgress; - BOOL filterInProgress; +@property (strong, nonatomic, readonly) NSData *buffer; +@property (assign, nonatomic, readonly) NSTimeInterval timeout; +@property (assign, nonatomic, readonly) long tag; - NSArray *resolvedAddresses; - NSError *resolveError; +@property (assign, nonatomic) BOOL resolveInProgress; +@property (assign, nonatomic) BOOL filterInProgress; +@property (strong, nonatomic) NSArray *resolvedAddresses; +@property (strong, nonatomic) NSError *resolveError; +@property (strong, nonatomic) NSData *address; +@property (assign, nonatomic) int addressFamily; - NSData *address; - int addressFamily; -} - -- (instancetype)initWithData:(NSData *)d timeout:(NSTimeInterval)t tag:(long)i; +- (instancetype)initWithData:(NSData *)data timeout:(NSTimeInterval)timeout tag:(long)tag; @end diff --git a/SuperSocket/SUDPSendPacket.m b/SuperSocket/SUDPSendPacket.m index a18de8b5..1cf205f9 100644 --- a/SuperSocket/SUDPSendPacket.m +++ b/SuperSocket/SUDPSendPacket.m @@ -8,16 +8,26 @@ #import "SUDPSendPacket.h" +@interface SUDPSendPacket () + +@property (strong, nonatomic, readwrite) NSData *buffer; +@property (assign, nonatomic, readwrite) NSTimeInterval timeout; +@property (assign, nonatomic, readwrite) long tag; + +@end + + @implementation SUDPSendPacket -- (instancetype)initWithData:(NSData *)d timeout:(NSTimeInterval)t tag:(long)i { +- (instancetype)initWithData:(NSData *)data timeout:(NSTimeInterval)timeout tag:(long)tag { if ((self = [super init])) { - buffer = d; - timeout = t; - tag = i; + _buffer = data; + _timeout = timeout; + _tag = tag; - resolveInProgress = NO; + _resolveInProgress = NO; } + return self; } diff --git a/SuperSocket/SUDPSocket.m b/SuperSocket/SUDPSocket.m index e09e3d10..6b7853ea 100644 --- a/SuperSocket/SUDPSocket.m +++ b/SuperSocket/SUDPSocket.m @@ -1521,10 +1521,10 @@ - (void)setupSendAndReceiveSourcesForSocket4 { if (currentSend == nil) { LogVerbose(@"Nothing to send"); [self suspendSend4Source]; - } else if (currentSend->resolveInProgress) { + } else if (currentSend.resolveInProgress) { LogVerbose(@"currentSend - waiting for address resolve"); [self suspendSend4Source]; - } else if (currentSend->filterInProgress) { + } else if (currentSend.filterInProgress) { LogVerbose(@"currentSend - waiting on sendFilter"); [self suspendSend4Source]; } else { @@ -1605,10 +1605,10 @@ - (void)setupSendAndReceiveSourcesForSocket6 { if (currentSend == nil) { LogVerbose(@"Nothing to send"); [self suspendSend6Source]; - } else if (currentSend->resolveInProgress) { + } else if (currentSend.resolveInProgress) { LogVerbose(@"currentSend - waiting for address resolve"); [self suspendSend6Source]; - } else if (currentSend->filterInProgress) { + } else if (currentSend.filterInProgress) { LogVerbose(@"currentSend - waiting on sendFilter"); [self suspendSend6Source]; } else { @@ -1922,9 +1922,8 @@ - (void)closeSockets { flags &= ~kDidCreateSockets; } -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + #pragma mark Diagnostics -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (BOOL)getLocalAddress:(NSData **)dataPtr host:(NSString **)hostPtr @@ -1959,12 +1958,15 @@ - (BOOL)getLocalAddress:(NSData **)dataPtr } } - if (dataPtr) + if (dataPtr) { *dataPtr = data; - if (hostPtr) + } + if (hostPtr) { *hostPtr = host; - if (portPtr) + } + if (portPtr) { *portPtr = port; + } return (data != nil); } @@ -2020,10 +2022,11 @@ - (NSData *)localAddress { }; - if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); - else + } else { dispatch_sync(socketQueue, AutoreleasedBlock(block)); + } return result; } @@ -2042,10 +2045,11 @@ - (NSString *)localHost { } }; - if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); - else + } else { dispatch_sync(socketQueue, AutoreleasedBlock(block)); + } return result; } @@ -2064,10 +2068,11 @@ - (uint16_t)localPort { } }; - if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); - else + } else { dispatch_sync(socketQueue, AutoreleasedBlock(block)); + } return result; } @@ -2081,10 +2086,11 @@ - (NSData *)localAddress_IPv4 { result = cachedLocalAddress4; }; - if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); - else + } else { dispatch_sync(socketQueue, AutoreleasedBlock(block)); + } return result; } @@ -2098,10 +2104,11 @@ - (NSString *)localHost_IPv4 { result = cachedLocalHost4; }; - if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); - else + } else { dispatch_sync(socketQueue, AutoreleasedBlock(block)); + } return result; } @@ -2115,10 +2122,11 @@ - (uint16_t)localPort_IPv4 { result = cachedLocalPort4; }; - if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); - else + } else { dispatch_sync(socketQueue, AutoreleasedBlock(block)); + } return result; } @@ -2132,10 +2140,11 @@ - (NSData *)localAddress_IPv6 { result = cachedLocalAddress6; }; - if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); - else + } else { dispatch_sync(socketQueue, AutoreleasedBlock(block)); + } return result; } @@ -2149,10 +2158,11 @@ - (NSString *)localHost_IPv6 { result = cachedLocalHost6; }; - if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); - else + } else { dispatch_sync(socketQueue, AutoreleasedBlock(block)); + } return result; } @@ -2165,11 +2175,12 @@ - (uint16_t)localPort_IPv6 { [self maybeUpdateCachedLocalAddress6Info]; result = cachedLocalPort6; }; - - if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); - else + } else { dispatch_sync(socketQueue, AutoreleasedBlock(block)); + } return result; } @@ -2228,10 +2239,11 @@ - (NSData *)connectedAddress { result = cachedConnectedAddress; }; - if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); - else + } else { dispatch_sync(socketQueue, AutoreleasedBlock(block)); + } return result; } @@ -2245,10 +2257,11 @@ - (NSString *)connectedHost { result = cachedConnectedHost; }; - if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); - else + } else { dispatch_sync(socketQueue, AutoreleasedBlock(block)); + } return result; } @@ -2262,10 +2275,11 @@ - (uint16_t)connectedPort { result = cachedConnectedPort; }; - if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); - else + } else { dispatch_sync(socketQueue, AutoreleasedBlock(block)); + } return result; } @@ -2293,10 +2307,11 @@ - (BOOL)isClosed { result = (flags & kDidCreateSockets) ? NO : YES; }; - if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); - else + } else { dispatch_sync(socketQueue, block); + } return result; } @@ -2313,10 +2328,11 @@ - (BOOL)isIPv4 { } }; - if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); - else + } else { dispatch_sync(socketQueue, block); + } return result; } @@ -2333,17 +2349,17 @@ - (BOOL)isIPv6 { } }; - if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); - else + } else { dispatch_sync(socketQueue, block); + } return result; } -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + #pragma mark Binding -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * This method runs through the various checks required prior to a bind attempt. @@ -2393,8 +2409,7 @@ - (BOOL)bindToPort:(uint16_t)port interface:(NSString *)interface error:(NSError __block BOOL result = NO; __block NSError *err = nil; - dispatch_block_t block = ^{ - @autoreleasepool { + dispatch_block_t block = ^{ @autoreleasepool { // Run through sanity checks if (![self preBind:&err]) { @@ -2483,19 +2498,21 @@ - (BOOL)bindToPort:(uint16_t)port interface:(NSString *)interface error:(NSError flags |= kIPv6Deactivated; result = YES; - } - }; + }}; - if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); - else + } else { dispatch_sync(socketQueue, block); + } - if (err) + if (err) { LogError(@"Error binding to port/interface: %@", err); + } - if (errPtr) + if (errPtr) { *errPtr = err; + } return result; } @@ -2589,35 +2606,38 @@ - (BOOL)bindToAddress:(NSData *)localAddr error:(NSError **)errPtr { } // Update flags - flags |= kDidBind; - if (!useIPv4) + if (!useIPv4) { flags |= kIPv4Deactivated; - if (!useIPv6) + } + if (!useIPv6) { flags |= kIPv6Deactivated; + } result = YES; } }; - if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); - else + } else { dispatch_sync(socketQueue, block); + } - if (err) + if (err) { LogError(@"Error binding to address: %@", err); + } - if (errPtr) + if (errPtr) { *errPtr = err; + } return result; } -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + #pragma mark Connecting -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * This method runs through the various checks required prior to a connect attempt. @@ -2639,8 +2659,7 @@ - (BOOL)preConnect:(NSError **)errPtr { BOOL isIPv4Disabled = (config & kIPv4Disabled) ? YES : NO; BOOL isIPv6Disabled = (config & kIPv6Disabled) ? YES : NO; - if (isIPv4Disabled && isIPv6Disabled) // Must have IPv4 or IPv6 enabled - { + if (isIPv4Disabled && isIPv6Disabled) { // Must have IPv4 or IPv6 enabled if (errPtr) { NSString *msg = @"Both IPv4 and IPv6 have been disabled. Must enable at least one protocol first."; *errPtr = [self badConfigError:msg]; @@ -2658,13 +2677,11 @@ - (BOOL)connectToHost:(NSString *)host onPort:(uint16_t)port error:(NSError **)e dispatch_block_t block = ^{ @autoreleasepool { // Run through sanity checks. - if (![self preConnect:&err]) { return_from_block; } // Check parameter(s) - if (host == nil) { NSString *msg = @"The host param is nil. Should be domain name or IP address string."; err = [self badParamError:msg]; @@ -2673,7 +2690,6 @@ - (BOOL)connectToHost:(NSString *)host onPort:(uint16_t)port error:(NSError **)e } // Create the socket(s) if needed - if ((flags & kDidCreateSockets) == 0) { if (![self createSockets:&err]) { return_from_block; @@ -2681,12 +2697,10 @@ - (BOOL)connectToHost:(NSString *)host onPort:(uint16_t)port error:(NSError **)e } // Create special connect packet - SUDPSpecialPacket *packet = [[SUDPSpecialPacket alloc] init]; packet->resolveInProgress = YES; // Start asynchronous DNS resolve for host:port on background queue - LogVerbose(@"Dispatching DNS resolve for connect..."); [self asyncResolveHost:host @@ -2716,16 +2730,19 @@ - (BOOL)connectToHost:(NSString *)host onPort:(uint16_t)port error:(NSError **)e } }; - if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); - else + } else { dispatch_sync(socketQueue, block); + } - if (err) + if (err) { LogError(@"Error connecting to host/port: %@", err); + } - if (errPtr) + if (errPtr) { *errPtr = err; + } return result; } @@ -2779,16 +2796,19 @@ - (BOOL)connectToAddress:(NSData *)remoteAddr error:(NSError **)errPtr { } }; - if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) + if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); - else + } else { dispatch_sync(socketQueue, block); + } - if (err) + if (err) { LogError(@"Error connecting to address: %@", err); + } - if (errPtr) + if (errPtr) { *errPtr = err; + } return result; } @@ -2797,7 +2817,6 @@ - (void)maybeConnect { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); - BOOL sendQueueReady = [currentSend isKindOfClass:[SUDPSpecialPacket class]]; if (sendQueueReady) { @@ -2815,16 +2834,15 @@ - (void)maybeConnect { int addressFamily = [self getAddress:&address error:&error fromAddresses:connectPacket->addresses]; // Perform connect - BOOL result = NO; switch (addressFamily) { - case AF_INET: + case AF_INET: { result = [self connectWithAddress4:address error:&error]; - break; - case AF_INET6: + } break; + case AF_INET6: { result = [self connectWithAddress6:address error:&error]; - break; + } break; } if (result) { @@ -2886,9 +2904,8 @@ - (BOOL)connectWithAddress6:(NSData *)address6 error:(NSError **)errPtr { return YES; } -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + #pragma mark Multicast -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (BOOL)preJoin:(NSError **)errPtr { if (![self preOp:errPtr]) { @@ -3137,9 +3154,8 @@ - (BOOL)enableBroadcast:(BOOL)flag error:(NSError **)errPtr { return result; } -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + #pragma mark Sending -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (void)sendData:(NSData *)data withTag:(long)tag { [self sendData:data withTimeout:-1.0 tag:tag]; @@ -3176,7 +3192,7 @@ - (void)sendData:(NSData *)data } SUDPSendPacket *packet = [[SUDPSendPacket alloc] initWithData:data timeout:timeout tag:tag]; - packet->resolveInProgress = YES; + packet.resolveInProgress = YES; [self asyncResolveHost:host port:port @@ -3185,11 +3201,9 @@ - (void)sendData:(NSData *)data // The asyncResolveHost:port:: method asynchronously dispatches a task onto the global concurrent queue, // and immediately returns. Once the async resolve task completes, // this block is executed on our socketQueue. - - packet->resolveInProgress = NO; - - packet->resolvedAddresses = addresses; - packet->resolveError = error; + packet.resolveInProgress = NO; + packet.resolvedAddresses = addresses; + packet.resolveError = error; if (packet == currentSend) { LogVerbose(@"currentSend - address resolved"); @@ -3214,8 +3228,8 @@ - (void)sendData:(NSData *)data toAddress:(NSData *)remoteAddr withTimeout:(NSTi } SUDPSendPacket *packet = [[SUDPSendPacket alloc] initWithData:data timeout:timeout tag:tag]; - packet->addressFamily = [SUDPSocket familyFromAddress:remoteAddr]; - packet->address = remoteAddr; + packet.addressFamily = [SUDPSocket familyFromAddress:remoteAddr]; + packet.address = remoteAddr; dispatch_async(socketQueue, ^{ @autoreleasepool { @@ -3278,9 +3292,9 @@ - (void)maybeDequeueSend { [self maybeConnect]; return; // The maybeConnect method, if it connects, will invoke this method again - } else if (currentSend->resolveError) { + } else if (currentSend.resolveError) { // Notify delegate - [self notifyDidNotSendDataWithTag:currentSend->tag dueToError:currentSend->resolveError]; + [self notifyDidNotSendDataWithTag:currentSend.tag dueToError:currentSend.resolveError]; // Clear currentSend currentSend = nil; @@ -3320,23 +3334,23 @@ - (void)doPreSend { if (flags & kDidConnect) { // Connected socket - if (currentSend->resolveInProgress || currentSend->resolvedAddresses || currentSend->resolveError) { + if (currentSend.resolveInProgress || currentSend.resolvedAddresses || currentSend.resolveError) { NSString *msg = @"Cannot specify destination of packet for connected socket"; error = [self badConfigError:msg]; } else { - currentSend->address = cachedConnectedAddress; - currentSend->addressFamily = cachedConnectedFamily; + currentSend.address = cachedConnectedAddress; + currentSend.addressFamily = cachedConnectedFamily; } } else { // Non-Connected socket - if (currentSend->resolveInProgress) { + if (currentSend.resolveInProgress) { // We're waiting for the packet's destination to be resolved. waitingForResolve = YES; - } else if (currentSend->resolveError) { - error = currentSend->resolveError; - } else if (currentSend->address == nil) { - if (currentSend->resolvedAddresses == nil) { + } else if (currentSend.resolveError) { + error = currentSend.resolveError; + } else if (currentSend.address == nil) { + if (currentSend.resolvedAddresses == nil) { NSString *msg = @"You must specify destination of packet for a non-connected socket"; error = [self badConfigError:msg]; } else { @@ -3345,10 +3359,10 @@ - (void)doPreSend { NSData *address = nil; int addressFamily = AF_UNSPEC; - addressFamily = [self getAddress:&address error:&error fromAddresses:currentSend->resolvedAddresses]; + addressFamily = [self getAddress:&address error:&error fromAddresses:currentSend.resolvedAddresses]; - currentSend->address = address; - currentSend->addressFamily = addressFamily; + currentSend.address = address; + currentSend.addressFamily = addressFamily; } } } @@ -3372,7 +3386,7 @@ - (void)doPreSend { // Unable to send packet due to some error. // Notify delegate and move on. - [self notifyDidNotSendDataWithTag:currentSend->tag dueToError:error]; + [self notifyDidNotSendDataWithTag:currentSend.tag dueToError:error]; [self endCurrentSend]; [self maybeDequeueSend]; @@ -3389,23 +3403,23 @@ - (void)doPreSend { if (sendFilterAsync) { // Scenario 1 of 3 - Need to asynchronously query sendFilter - currentSend->filterInProgress = YES; + currentSend.filterInProgress = YES; SUDPSendPacket *sendPacket = currentSend; dispatch_async(sendFilterQueue, ^{ @autoreleasepool { - BOOL allowed = sendFilterBlock(sendPacket->buffer, sendPacket->address, sendPacket->tag); + BOOL allowed = sendFilterBlock(sendPacket.buffer, sendPacket.address, sendPacket.tag); dispatch_async(socketQueue, ^{ @autoreleasepool { - sendPacket->filterInProgress = NO; + sendPacket.filterInProgress = NO; if (sendPacket == currentSend) { if (allowed) { [self doSend]; } else { LogVerbose(@"currentSend - silently dropped by sendFilter"); - [self notifyDidSendDataWithTag:currentSend->tag]; + [self notifyDidSendDataWithTag:currentSend.tag]; [self endCurrentSend]; [self maybeDequeueSend]; } @@ -3421,7 +3435,7 @@ - (void)doPreSend { dispatch_sync(sendFilterQueue, ^{ @autoreleasepool { - allowed = sendFilterBlock(currentSend->buffer, currentSend->address, currentSend->tag); + allowed = sendFilterBlock(currentSend.buffer, currentSend.address, currentSend.tag); } }); @@ -3430,7 +3444,7 @@ - (void)doPreSend { } else { LogVerbose(@"currentSend - silently dropped by sendFilter"); - [self notifyDidSendDataWithTag:currentSend->tag]; + [self notifyDidSendDataWithTag:currentSend.tag]; [self endCurrentSend]; [self maybeDequeueSend]; } @@ -3459,10 +3473,10 @@ - (void)doSend { if (flags & kDidConnect) { // Connected socket - const void *buffer = [currentSend->buffer bytes]; - size_t length = (size_t)[currentSend->buffer length]; + const void *buffer = [currentSend.buffer bytes]; + size_t length = (size_t)[currentSend.buffer length]; - if (currentSend->addressFamily == AF_INET) { + if (currentSend.addressFamily == AF_INET) { result = send(socket4FD, buffer, length, 0); LogVerbose(@"send(socket4FD) = %d", result); } else { @@ -3472,13 +3486,13 @@ - (void)doSend { } else { // Non-Connected socket - const void *buffer = [currentSend->buffer bytes]; - size_t length = (size_t)[currentSend->buffer length]; + const void *buffer = [currentSend.buffer bytes]; + size_t length = (size_t)[currentSend.buffer length]; - const void *dst = [currentSend->address bytes]; - socklen_t dstSize = (socklen_t)[currentSend->address length]; + const void *dst = [currentSend.address bytes]; + socklen_t dstSize = (socklen_t)[currentSend.address length]; - if (currentSend->addressFamily == AF_INET) { + if (currentSend.addressFamily == AF_INET) { result = sendto(socket4FD, buffer, length, 0, dst, dstSize); LogVerbose(@"sendto(socket4FD) = %d", result); } else { @@ -3525,17 +3539,17 @@ - (void)doSend { [self resumeSend6Source]; } - if ((sendTimer == NULL) && (currentSend->timeout >= 0.0)) { + if ((sendTimer == NULL) && (currentSend.timeout >= 0.0)) { // Unable to send packet right away. // Start timer to timeout the send operation. - [self setupSendTimerWithTimeout:currentSend->timeout]; + [self setupSendTimerWithTimeout:currentSend.timeout]; } } else if (socketError) { [self closeWithError:socketError]; } else // done { - [self notifyDidSendDataWithTag:currentSend->tag]; + [self notifyDidSendDataWithTag:currentSend.tag]; [self endCurrentSend]; [self maybeDequeueSend]; } @@ -3559,7 +3573,7 @@ - (void)endCurrentSend { - (void)doSendTimeout { LogTrace(); - [self notifyDidNotSendDataWithTag:currentSend->tag dueToError:[self sendTimeoutError]]; + [self notifyDidNotSendDataWithTag:currentSend.tag dueToError:[self sendTimeoutError]]; [self endCurrentSend]; [self maybeDequeueSend]; } @@ -3588,9 +3602,8 @@ - (void)setupSendTimerWithTimeout:(NSTimeInterval)timeout { dispatch_resume(sendTimer); } -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + #pragma mark Receiving -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (BOOL)receiveOnce:(NSError **)errPtr { LogTrace(); From 564db26c90ad56b064067102d2d60379eed2f207 Mon Sep 17 00:00:00 2001 From: Joel Fischer Date: Thu, 24 Sep 2015 09:42:25 -0400 Subject: [PATCH 02/12] Don't strip on release builds --- SuperSocket.xcodeproj/project.pbxproj | 2 ++ SuperSocket/SuperSocket.h | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SuperSocket.xcodeproj/project.pbxproj b/SuperSocket.xcodeproj/project.pbxproj index 24e132fc..81cecb7e 100644 --- a/SuperSocket.xcodeproj/project.pbxproj +++ b/SuperSocket.xcodeproj/project.pbxproj @@ -417,6 +417,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_STATIC_ANALYZER_MODE = deep; + COPY_PHASE_STRIP = NO; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -436,6 +437,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_STATIC_ANALYZER_MODE = deep; + COPY_PHASE_STRIP = NO; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; diff --git a/SuperSocket/SuperSocket.h b/SuperSocket/SuperSocket.h index a481b12c..eb5712d7 100644 --- a/SuperSocket/SuperSocket.h +++ b/SuperSocket/SuperSocket.h @@ -15,8 +15,6 @@ FOUNDATION_EXPORT double SuperSocketVersionNumber; //! Project version string for CocoaAsyncSocket. FOUNDATION_EXPORT const unsigned char SuperSocketVersionString[]; -// In this header, you should import all the public headers of your framework using statements like #import - #import #import #import From 1b24f987b50d34127433749492800c571a1e1cd8 Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Fri, 23 Oct 2015 08:41:23 +1100 Subject: [PATCH 03/12] Rename iOS target and scheme --- SuperSocket.xcodeproj/project.pbxproj | 12 ++++++------ ...ket-Release.xcscheme => SuperSocket iOS.xcscheme} | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) rename SuperSocket.xcodeproj/xcshareddata/xcschemes/{SuperSocket-Release.xcscheme => SuperSocket iOS.xcscheme} (95%) diff --git a/SuperSocket.xcodeproj/project.pbxproj b/SuperSocket.xcodeproj/project.pbxproj index 24e132fc..a75e82dd 100644 --- a/SuperSocket.xcodeproj/project.pbxproj +++ b/SuperSocket.xcodeproj/project.pbxproj @@ -205,9 +205,9 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 5D4833091A9D074D00252386 /* SuperSocket */ = { + 5D4833091A9D074D00252386 /* SuperSocket iOS */ = { isa = PBXNativeTarget; - buildConfigurationList = 5D4833201A9D074D00252386 /* Build configuration list for PBXNativeTarget "SuperSocket" */; + buildConfigurationList = 5D4833201A9D074D00252386 /* Build configuration list for PBXNativeTarget "SuperSocket iOS" */; buildPhases = ( 5D4833051A9D074D00252386 /* Sources */, 5D4833061A9D074D00252386 /* Frameworks */, @@ -218,7 +218,7 @@ ); dependencies = ( ); - name = SuperSocket; + name = "SuperSocket iOS"; productName = CocoaAsyncSocket; productReference = 5D48330A1A9D074D00252386 /* SuperSocket.framework */; productType = "com.apple.product-type.framework"; @@ -270,7 +270,7 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 5D4833091A9D074D00252386 /* SuperSocket */, + 5D4833091A9D074D00252386 /* SuperSocket iOS */, 5D77F9A71B55992D0013F9A7 /* SuperSocketTests */, ); }; @@ -322,7 +322,7 @@ /* Begin PBXTargetDependency section */ 5D77F9AF1B55992D0013F9A7 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 5D4833091A9D074D00252386 /* SuperSocket */; + target = 5D4833091A9D074D00252386 /* SuperSocket iOS */; targetProxy = 5D77F9AE1B55992D0013F9A7 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ @@ -490,7 +490,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 5D4833201A9D074D00252386 /* Build configuration list for PBXNativeTarget "SuperSocket" */ = { + 5D4833201A9D074D00252386 /* Build configuration list for PBXNativeTarget "SuperSocket iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( 5D4833211A9D074D00252386 /* Debug */, diff --git a/SuperSocket.xcodeproj/xcshareddata/xcschemes/SuperSocket-Release.xcscheme b/SuperSocket.xcodeproj/xcshareddata/xcschemes/SuperSocket iOS.xcscheme similarity index 95% rename from SuperSocket.xcodeproj/xcshareddata/xcschemes/SuperSocket-Release.xcscheme rename to SuperSocket.xcodeproj/xcshareddata/xcschemes/SuperSocket iOS.xcscheme index e03d2c5d..a742a7b5 100644 --- a/SuperSocket.xcodeproj/xcshareddata/xcschemes/SuperSocket-Release.xcscheme +++ b/SuperSocket.xcodeproj/xcshareddata/xcschemes/SuperSocket iOS.xcscheme @@ -16,7 +16,7 @@ BuildableIdentifier = "primary" BlueprintIdentifier = "5D4833091A9D074D00252386" BuildableName = "SuperSocket.framework" - BlueprintName = "SuperSocket" + BlueprintName = "SuperSocket iOS" ReferencedContainer = "container:SuperSocket.xcodeproj"> @@ -47,7 +47,7 @@ BuildableIdentifier = "primary" BlueprintIdentifier = "5D4833091A9D074D00252386" BuildableName = "SuperSocket.framework" - BlueprintName = "SuperSocket" + BlueprintName = "SuperSocket iOS" ReferencedContainer = "container:SuperSocket.xcodeproj"> @@ -65,7 +65,7 @@ BuildableIdentifier = "primary" BlueprintIdentifier = "5D4833091A9D074D00252386" BuildableName = "SuperSocket.framework" - BlueprintName = "SuperSocket" + BlueprintName = "SuperSocket iOS" ReferencedContainer = "container:SuperSocket.xcodeproj"> From 8d2311cbaafdb6e40f6edf37eb8f34fff8040e7b Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Fri, 23 Oct 2015 08:50:34 +1100 Subject: [PATCH 04/12] First crack at Mac target --- SuperSocket.xcodeproj/project.pbxproj | 145 ++++++++++++++++++ .../xcschemes/SuperSocket Mac.xcscheme | 80 ++++++++++ SuperSocket/SuperSocket.h | 2 - 3 files changed, 225 insertions(+), 2 deletions(-) create mode 100644 SuperSocket.xcodeproj/xcshareddata/xcschemes/SuperSocket Mac.xcscheme diff --git a/SuperSocket.xcodeproj/project.pbxproj b/SuperSocket.xcodeproj/project.pbxproj index a75e82dd..482d36e9 100644 --- a/SuperSocket.xcodeproj/project.pbxproj +++ b/SuperSocket.xcodeproj/project.pbxproj @@ -28,6 +28,19 @@ 5D77F9C81B55A13A0013F9A7 /* STCPWritePacket.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D77F9C61B55A13A0013F9A7 /* STCPWritePacket.m */; }; 5D77F9CF1B55A8B30013F9A7 /* STCPSocketDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D77F9CE1B55A8B30013F9A7 /* STCPSocketDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5D77F9D21B55AAD80013F9A7 /* SUDPSocketDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D77F9D11B55AAD80013F9A7 /* SUDPSocketDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BFFBFEA91BD98FD70004CC87 /* SuperSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = BFFBFEA81BD98FD70004CC87 /* SuperSocket.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BFFBFEAE1BD990D80004CC87 /* STCPSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D77F9961B5597510013F9A7 /* STCPSocket.m */; }; + BFFBFEAF1BD990D80004CC87 /* STCPSocketPreBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D77F9BE1B55A0CC0013F9A7 /* STCPSocketPreBuffer.m */; }; + BFFBFEB01BD990D80004CC87 /* STCPReadPacket.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D77F9C21B55A10B0013F9A7 /* STCPReadPacket.m */; }; + BFFBFEB11BD990D80004CC87 /* STCPWritePacket.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D77F9C61B55A13A0013F9A7 /* STCPWritePacket.m */; }; + BFFBFEB21BD990D80004CC87 /* STCPSpecialPacket.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D1DC7F71B754B6100236EE6 /* STCPSpecialPacket.m */; }; + BFFBFEB31BD990D80004CC87 /* SUDPSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D77F9981B5597510013F9A7 /* SUDPSocket.m */; }; + BFFBFEB41BD990D80004CC87 /* SUDPSendPacket.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D77F9B51B559FF90013F9A7 /* SUDPSendPacket.m */; }; + BFFBFEB51BD990D80004CC87 /* SUDPSpecialPacket.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D77F9B91B55A0690013F9A7 /* SUDPSpecialPacket.m */; }; + BFFBFEB61BD991800004CC87 /* STCPSocketDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D77F9CE1B55A8B30013F9A7 /* STCPSocketDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BFFBFEB71BD991800004CC87 /* STCPSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D77F9951B5597510013F9A7 /* STCPSocket.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BFFBFEB81BD991800004CC87 /* SUDPSocketDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D77F9D11B55AAD80013F9A7 /* SUDPSocketDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BFFBFEB91BD991800004CC87 /* SUDPSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D77F9971B5597510013F9A7 /* SUDPSocket.h */; settings = {ATTRIBUTES = (Public, ); }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -65,6 +78,9 @@ 5D77F9C61B55A13A0013F9A7 /* STCPWritePacket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = STCPWritePacket.m; path = SuperSocket/STCPWritePacket.m; sourceTree = SOURCE_ROOT; }; 5D77F9CE1B55A8B30013F9A7 /* STCPSocketDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STCPSocketDelegate.h; path = SuperSocket/STCPSocketDelegate.h; sourceTree = SOURCE_ROOT; }; 5D77F9D11B55AAD80013F9A7 /* SUDPSocketDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUDPSocketDelegate.h; path = SuperSocket/SUDPSocketDelegate.h; sourceTree = SOURCE_ROOT; }; + BFFBFEA61BD98FD70004CC87 /* SuperSocket.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SuperSocket.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + BFFBFEA81BD98FD70004CC87 /* SuperSocket.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SuperSocket.h; sourceTree = ""; }; + BFFBFEAA1BD98FD70004CC87 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -83,6 +99,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + BFFBFEA21BD98FD70004CC87 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -91,6 +114,7 @@ children = ( 5D48330C1A9D074D00252386 /* SuperSocket */, 5D77F9A91B55992D0013F9A7 /* SuperSocketTests */, + BFFBFEA71BD98FD70004CC87 /* SuperSocket */, 5D48330B1A9D074D00252386 /* Products */, ); sourceTree = ""; @@ -100,6 +124,7 @@ children = ( 5D48330A1A9D074D00252386 /* SuperSocket.framework */, 5D77F9A81B55992D0013F9A7 /* SuperSocketTests.xctest */, + BFFBFEA61BD98FD70004CC87 /* SuperSocket.framework */, ); name = Products; sourceTree = ""; @@ -181,6 +206,15 @@ name = Internal; sourceTree = ""; }; + BFFBFEA71BD98FD70004CC87 /* SuperSocket */ = { + isa = PBXGroup; + children = ( + BFFBFEA81BD98FD70004CC87 /* SuperSocket.h */, + BFFBFEAA1BD98FD70004CC87 /* Info.plist */, + ); + path = SuperSocket; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -202,6 +236,18 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + BFFBFEA31BD98FD70004CC87 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + BFFBFEB61BD991800004CC87 /* STCPSocketDelegate.h in Headers */, + BFFBFEA91BD98FD70004CC87 /* SuperSocket.h in Headers */, + BFFBFEB81BD991800004CC87 /* SUDPSocketDelegate.h in Headers */, + BFFBFEB91BD991800004CC87 /* SUDPSocket.h in Headers */, + BFFBFEB71BD991800004CC87 /* STCPSocket.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ @@ -241,6 +287,24 @@ productReference = 5D77F9A81B55992D0013F9A7 /* SuperSocketTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; + BFFBFEA51BD98FD70004CC87 /* SuperSocket Mac */ = { + isa = PBXNativeTarget; + buildConfigurationList = BFFBFEAB1BD98FD70004CC87 /* Build configuration list for PBXNativeTarget "SuperSocket Mac" */; + buildPhases = ( + BFFBFEA11BD98FD70004CC87 /* Sources */, + BFFBFEA21BD98FD70004CC87 /* Frameworks */, + BFFBFEA31BD98FD70004CC87 /* Headers */, + BFFBFEA41BD98FD70004CC87 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "SuperSocket Mac"; + productName = SuperSocket; + productReference = BFFBFEA61BD98FD70004CC87 /* SuperSocket.framework */; + productType = "com.apple.product-type.framework"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -256,6 +320,9 @@ 5D77F9A71B55992D0013F9A7 = { CreatedOnToolsVersion = 7.0; }; + BFFBFEA51BD98FD70004CC87 = { + CreatedOnToolsVersion = 7.1; + }; }; }; buildConfigurationList = 5D4833041A9D074D00252386 /* Build configuration list for PBXProject "SuperSocket" */; @@ -271,6 +338,7 @@ projectRoot = ""; targets = ( 5D4833091A9D074D00252386 /* SuperSocket iOS */, + BFFBFEA51BD98FD70004CC87 /* SuperSocket Mac */, 5D77F9A71B55992D0013F9A7 /* SuperSocketTests */, ); }; @@ -291,6 +359,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + BFFBFEA41BD98FD70004CC87 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -317,6 +392,21 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + BFFBFEA11BD98FD70004CC87 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BFFBFEB01BD990D80004CC87 /* STCPReadPacket.m in Sources */, + BFFBFEB41BD990D80004CC87 /* SUDPSendPacket.m in Sources */, + BFFBFEB11BD990D80004CC87 /* STCPWritePacket.m in Sources */, + BFFBFEB51BD990D80004CC87 /* SUDPSpecialPacket.m in Sources */, + BFFBFEAF1BD990D80004CC87 /* STCPSocketPreBuffer.m in Sources */, + BFFBFEAE1BD990D80004CC87 /* STCPSocket.m in Sources */, + BFFBFEB31BD990D80004CC87 /* SUDPSocket.m in Sources */, + BFFBFEB21BD990D80004CC87 /* STCPSpecialPacket.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -478,6 +568,53 @@ }; name = Release; }; + BFFBFEAC1BD98FD70004CC87 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = SuperSocket/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + PRODUCT_BUNDLE_IDENTIFIER = com.livio.SuperSocket; + PRODUCT_NAME = SuperSocket; + SDKROOT = macosx; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + BFFBFEAD1BD98FD70004CC87 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = SuperSocket/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + PRODUCT_BUNDLE_IDENTIFIER = com.livio.SuperSocket; + PRODUCT_NAME = SuperSocket; + SDKROOT = macosx; + SKIP_INSTALL = YES; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -508,6 +645,14 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + BFFBFEAB1BD98FD70004CC87 /* Build configuration list for PBXNativeTarget "SuperSocket Mac" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + BFFBFEAC1BD98FD70004CC87 /* Debug */, + BFFBFEAD1BD98FD70004CC87 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; /* End XCConfigurationList section */ }; rootObject = 5D4833011A9D074D00252386 /* Project object */; diff --git a/SuperSocket.xcodeproj/xcshareddata/xcschemes/SuperSocket Mac.xcscheme b/SuperSocket.xcodeproj/xcshareddata/xcschemes/SuperSocket Mac.xcscheme new file mode 100644 index 00000000..9a5a70f0 --- /dev/null +++ b/SuperSocket.xcodeproj/xcshareddata/xcschemes/SuperSocket Mac.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SuperSocket/SuperSocket.h b/SuperSocket/SuperSocket.h index a481b12c..7f79925b 100644 --- a/SuperSocket/SuperSocket.h +++ b/SuperSocket/SuperSocket.h @@ -7,8 +7,6 @@ // Based on https://github.com/robbiehanson/CocoaAsyncSocket // -#import - //! Project version number for CocoaAsyncSocket. FOUNDATION_EXPORT double SuperSocketVersionNumber; From 683ef4daeb4e51893db33c88d2a370927d096d3d Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Fri, 23 Oct 2015 09:00:59 +1100 Subject: [PATCH 05/12] Fix up code signing default --- SuperSocket.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SuperSocket.xcodeproj/project.pbxproj b/SuperSocket.xcodeproj/project.pbxproj index 482d36e9..5cf5e2da 100644 --- a/SuperSocket.xcodeproj/project.pbxproj +++ b/SuperSocket.xcodeproj/project.pbxproj @@ -571,7 +571,7 @@ BFFBFEAC1BD98FD70004CC87 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CODE_SIGN_IDENTITY = "-"; + CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = YES; @@ -594,7 +594,7 @@ BFFBFEAD1BD98FD70004CC87 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CODE_SIGN_IDENTITY = "-"; + CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; From eeccc5335f390e400876ab77cfa8370559bde661 Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Fri, 23 Oct 2015 18:41:11 +1100 Subject: [PATCH 06/12] Renamed buildablename --- .../xcshareddata/xcschemes/SuperSocket Mac.xcscheme | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SuperSocket.xcodeproj/xcshareddata/xcschemes/SuperSocket Mac.xcscheme b/SuperSocket.xcodeproj/xcshareddata/xcschemes/SuperSocket Mac.xcscheme index 9a5a70f0..9f07ae0e 100644 --- a/SuperSocket.xcodeproj/xcshareddata/xcschemes/SuperSocket Mac.xcscheme +++ b/SuperSocket.xcodeproj/xcshareddata/xcschemes/SuperSocket Mac.xcscheme @@ -15,7 +15,7 @@ @@ -46,7 +46,7 @@ @@ -64,7 +64,7 @@ From 5a61a7c4083c41b6982005cf7db0ae10b76f16f7 Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Fri, 23 Oct 2015 18:54:56 +1100 Subject: [PATCH 07/12] Import Foundation --- SuperSocket/SuperSocket.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SuperSocket/SuperSocket.h b/SuperSocket/SuperSocket.h index 7f79925b..aa2327a3 100644 --- a/SuperSocket/SuperSocket.h +++ b/SuperSocket/SuperSocket.h @@ -7,6 +7,8 @@ // Based on https://github.com/robbiehanson/CocoaAsyncSocket // +#import + //! Project version number for CocoaAsyncSocket. FOUNDATION_EXPORT double SuperSocketVersionNumber; From 2c0f8e780fd28edf49689c7181e66956d7b1c3b5 Mon Sep 17 00:00:00 2001 From: Joel Fischer Date: Fri, 20 Nov 2015 10:36:46 -0500 Subject: [PATCH 08/12] Update release scheme xcode auto-changed --- .../xcshareddata/xcschemes/SuperSocket-Release.xcscheme | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/SuperSocket.xcodeproj/xcshareddata/xcschemes/SuperSocket-Release.xcscheme b/SuperSocket.xcodeproj/xcshareddata/xcschemes/SuperSocket-Release.xcscheme index e03d2c5d..c3b883f2 100644 --- a/SuperSocket.xcodeproj/xcshareddata/xcschemes/SuperSocket-Release.xcscheme +++ b/SuperSocket.xcodeproj/xcshareddata/xcschemes/SuperSocket-Release.xcscheme @@ -51,6 +51,13 @@ ReferencedContainer = "container:SuperSocket.xcodeproj"> + + + + From 22e08e1f5ffa2111297382f6a053381a8e952f63 Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Sat, 21 Nov 2015 09:02:56 +1100 Subject: [PATCH 09/12] Removed duplicate group (and duplicate references to SuperSocket.h/Info.plist) --- SuperSocket.xcodeproj/project.pbxproj | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/SuperSocket.xcodeproj/project.pbxproj b/SuperSocket.xcodeproj/project.pbxproj index 5cf5e2da..ca2294a7 100644 --- a/SuperSocket.xcodeproj/project.pbxproj +++ b/SuperSocket.xcodeproj/project.pbxproj @@ -28,7 +28,6 @@ 5D77F9C81B55A13A0013F9A7 /* STCPWritePacket.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D77F9C61B55A13A0013F9A7 /* STCPWritePacket.m */; }; 5D77F9CF1B55A8B30013F9A7 /* STCPSocketDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D77F9CE1B55A8B30013F9A7 /* STCPSocketDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5D77F9D21B55AAD80013F9A7 /* SUDPSocketDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D77F9D11B55AAD80013F9A7 /* SUDPSocketDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; - BFFBFEA91BD98FD70004CC87 /* SuperSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = BFFBFEA81BD98FD70004CC87 /* SuperSocket.h */; settings = {ATTRIBUTES = (Public, ); }; }; BFFBFEAE1BD990D80004CC87 /* STCPSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D77F9961B5597510013F9A7 /* STCPSocket.m */; }; BFFBFEAF1BD990D80004CC87 /* STCPSocketPreBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D77F9BE1B55A0CC0013F9A7 /* STCPSocketPreBuffer.m */; }; BFFBFEB01BD990D80004CC87 /* STCPReadPacket.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D77F9C21B55A10B0013F9A7 /* STCPReadPacket.m */; }; @@ -79,8 +78,6 @@ 5D77F9CE1B55A8B30013F9A7 /* STCPSocketDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STCPSocketDelegate.h; path = SuperSocket/STCPSocketDelegate.h; sourceTree = SOURCE_ROOT; }; 5D77F9D11B55AAD80013F9A7 /* SUDPSocketDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUDPSocketDelegate.h; path = SuperSocket/SUDPSocketDelegate.h; sourceTree = SOURCE_ROOT; }; BFFBFEA61BD98FD70004CC87 /* SuperSocket.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SuperSocket.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - BFFBFEA81BD98FD70004CC87 /* SuperSocket.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SuperSocket.h; sourceTree = ""; }; - BFFBFEAA1BD98FD70004CC87 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -114,7 +111,6 @@ children = ( 5D48330C1A9D074D00252386 /* SuperSocket */, 5D77F9A91B55992D0013F9A7 /* SuperSocketTests */, - BFFBFEA71BD98FD70004CC87 /* SuperSocket */, 5D48330B1A9D074D00252386 /* Products */, ); sourceTree = ""; @@ -206,15 +202,6 @@ name = Internal; sourceTree = ""; }; - BFFBFEA71BD98FD70004CC87 /* SuperSocket */ = { - isa = PBXGroup; - children = ( - BFFBFEA81BD98FD70004CC87 /* SuperSocket.h */, - BFFBFEAA1BD98FD70004CC87 /* Info.plist */, - ); - path = SuperSocket; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -241,7 +228,6 @@ buildActionMask = 2147483647; files = ( BFFBFEB61BD991800004CC87 /* STCPSocketDelegate.h in Headers */, - BFFBFEA91BD98FD70004CC87 /* SuperSocket.h in Headers */, BFFBFEB81BD991800004CC87 /* SUDPSocketDelegate.h in Headers */, BFFBFEB91BD991800004CC87 /* SUDPSocket.h in Headers */, BFFBFEB71BD991800004CC87 /* STCPSocket.h in Headers */, @@ -652,6 +638,7 @@ BFFBFEAD1BD98FD70004CC87 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; From cbc473e90dde5d52311ac07d7943f93263582632 Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Sat, 21 Nov 2015 09:31:56 +1100 Subject: [PATCH 10/12] Added platform support for iOS and Mac (had to rename spec file from supersocket.podspec to SuperSocket.podspec to pass pod spec lint) --- supersocket.podspec => SuperSocket.podspec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) rename supersocket.podspec => SuperSocket.podspec (86%) diff --git a/supersocket.podspec b/SuperSocket.podspec similarity index 86% rename from supersocket.podspec rename to SuperSocket.podspec index 3e13ef28..3b3c2a64 100644 --- a/supersocket.podspec +++ b/SuperSocket.podspec @@ -7,4 +7,6 @@ Pod::Spec.new do |spec| spec.summary = 'Asynchronous socket networking library forked from CocoaAsyncSocket' spec.source = { :git => 'https://github.com/livio/supersocket.git', :tag => spec.version.to_s } spec.source_files = 'SuperSocket/*.{h,m}' -end \ No newline at end of file + spec.ios.deployment_target = '8.0' + spec.osx.deployment_target = '10.9' +end From 923ec7864580ef202dba7b1510435d923d2a4233 Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Sat, 21 Nov 2015 09:43:36 +1100 Subject: [PATCH 11/12] Add header back into Mac framework so that it will be picked up as the umbrella header. --- SuperSocket.xcodeproj/project.pbxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SuperSocket.xcodeproj/project.pbxproj b/SuperSocket.xcodeproj/project.pbxproj index ca2294a7..1ed6e6fa 100644 --- a/SuperSocket.xcodeproj/project.pbxproj +++ b/SuperSocket.xcodeproj/project.pbxproj @@ -28,6 +28,7 @@ 5D77F9C81B55A13A0013F9A7 /* STCPWritePacket.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D77F9C61B55A13A0013F9A7 /* STCPWritePacket.m */; }; 5D77F9CF1B55A8B30013F9A7 /* STCPSocketDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D77F9CE1B55A8B30013F9A7 /* STCPSocketDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5D77F9D21B55AAD80013F9A7 /* SUDPSocketDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D77F9D11B55AAD80013F9A7 /* SUDPSocketDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BFD94EF11BFFD93E004F0576 /* SuperSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D77F9991B5597510013F9A7 /* SuperSocket.h */; settings = {ATTRIBUTES = (Public, ); }; }; BFFBFEAE1BD990D80004CC87 /* STCPSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D77F9961B5597510013F9A7 /* STCPSocket.m */; }; BFFBFEAF1BD990D80004CC87 /* STCPSocketPreBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D77F9BE1B55A0CC0013F9A7 /* STCPSocketPreBuffer.m */; }; BFFBFEB01BD990D80004CC87 /* STCPReadPacket.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D77F9C21B55A10B0013F9A7 /* STCPReadPacket.m */; }; @@ -227,6 +228,7 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + BFD94EF11BFFD93E004F0576 /* SuperSocket.h in Headers */, BFFBFEB61BD991800004CC87 /* STCPSocketDelegate.h in Headers */, BFFBFEB81BD991800004CC87 /* SUDPSocketDelegate.h in Headers */, BFFBFEB91BD991800004CC87 /* SUDPSocket.h in Headers */, From 0267fa65739dbb14a053c69f921d6eccdc2994b3 Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Tue, 24 Nov 2015 12:09:43 +1100 Subject: [PATCH 12/12] Change remaining headers to Project scope to be in line with the iOS target --- SuperSocket.xcodeproj/project.pbxproj | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/SuperSocket.xcodeproj/project.pbxproj b/SuperSocket.xcodeproj/project.pbxproj index 1ed6e6fa..81385bfc 100644 --- a/SuperSocket.xcodeproj/project.pbxproj +++ b/SuperSocket.xcodeproj/project.pbxproj @@ -28,6 +28,12 @@ 5D77F9C81B55A13A0013F9A7 /* STCPWritePacket.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D77F9C61B55A13A0013F9A7 /* STCPWritePacket.m */; }; 5D77F9CF1B55A8B30013F9A7 /* STCPSocketDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D77F9CE1B55A8B30013F9A7 /* STCPSocketDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5D77F9D21B55AAD80013F9A7 /* SUDPSocketDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D77F9D11B55AAD80013F9A7 /* SUDPSocketDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BF0B33451C03F03E00633F54 /* STCPSocketPreBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D77F9BD1B55A0CC0013F9A7 /* STCPSocketPreBuffer.h */; }; + BF0B33461C03F03E00633F54 /* STCPReadPacket.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D77F9C11B55A10B0013F9A7 /* STCPReadPacket.h */; }; + BF0B33471C03F03E00633F54 /* STCPWritePacket.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D77F9C51B55A13A0013F9A7 /* STCPWritePacket.h */; }; + BF0B33481C03F03E00633F54 /* STCPSpecialPacket.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D1DC7F61B754B6100236EE6 /* STCPSpecialPacket.h */; }; + BF0B33491C03F03E00633F54 /* SUDPSendPacket.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D77F9B41B559FF90013F9A7 /* SUDPSendPacket.h */; }; + BF0B334A1C03F03E00633F54 /* SUDPSpecialPacket.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D77F9B81B55A0690013F9A7 /* SUDPSpecialPacket.h */; }; BFD94EF11BFFD93E004F0576 /* SuperSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D77F9991B5597510013F9A7 /* SuperSocket.h */; settings = {ATTRIBUTES = (Public, ); }; }; BFFBFEAE1BD990D80004CC87 /* STCPSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D77F9961B5597510013F9A7 /* STCPSocket.m */; }; BFFBFEAF1BD990D80004CC87 /* STCPSocketPreBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D77F9BE1B55A0CC0013F9A7 /* STCPSocketPreBuffer.m */; }; @@ -233,6 +239,12 @@ BFFBFEB81BD991800004CC87 /* SUDPSocketDelegate.h in Headers */, BFFBFEB91BD991800004CC87 /* SUDPSocket.h in Headers */, BFFBFEB71BD991800004CC87 /* STCPSocket.h in Headers */, + BF0B33451C03F03E00633F54 /* STCPSocketPreBuffer.h in Headers */, + BF0B33461C03F03E00633F54 /* STCPReadPacket.h in Headers */, + BF0B33471C03F03E00633F54 /* STCPWritePacket.h in Headers */, + BF0B33481C03F03E00633F54 /* STCPSpecialPacket.h in Headers */, + BF0B33491C03F03E00633F54 /* SUDPSendPacket.h in Headers */, + BF0B334A1C03F03E00633F54 /* SUDPSpecialPacket.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; };