Skip to content

Commit fa70fb6

Browse files
committed
Fixing bug where secure sockets weren't properly reporting disconnections. Fixes issues robbiehanson#111 & robbiehanson#113.
1 parent 1d8ab7d commit fa70fb6

File tree

4 files changed

+453
-63
lines changed

4 files changed

+453
-63
lines changed

GCD/GCDAsyncSocket.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
4343

4444
@interface GCDAsyncSocket : NSObject
4545
{
46-
uint16_t flags;
46+
uint32_t flags;
4747
uint16_t config;
4848

4949
id delegate;
@@ -328,13 +328,22 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
328328

329329
/**
330330
* Disconnects immediately (synchronously). Any pending reads or writes are dropped.
331-
* If the socket is not already disconnected, the socketDidDisconnect delegate method
332-
* will be called immediately, before this method returns.
333331
*
334-
* Please note the recommended way of releasing an AsyncSocket instance (e.g. in a dealloc method)
332+
* If the socket is not already disconnected, an invocation to the socketDidDisconnect:withError: delegate method
333+
* will be queued onto the delegateQueue asynchronously (behind any previously queued delegate methods).
334+
* In other words, the disconnected delegate method will be invoked sometime shortly after this method returns.
335+
*
336+
* Please note the recommended way of releasing a GCDAsyncSocket instance (e.g. in a dealloc method)
335337
* [asyncSocket setDelegate:nil];
336338
* [asyncSocket disconnect];
337339
* [asyncSocket release];
340+
*
341+
* If you plan on disconnecting the socket, and then immediately asking it to connect again,
342+
* you'll likely want to do so like this:
343+
* [asyncSocket setDelegate:nil];
344+
* [asyncSocket disconnect];
345+
* [asyncSocket setDelegate:self];
346+
* [asyncSocket connect...];
338347
**/
339348
- (void)disconnect;
340349

0 commit comments

Comments
 (0)