Fixed: The -connection:failedToOpen: delegate method wasn't being called.
authorJens Alfke <jens@mooseyard.com>
Tue Jun 10 16:14:20 2008 -0700 (2008-06-10)
changeset 15f723174fbc24
parent 14 bb5faa9995d5
child 16 6f608b552b77
Fixed: The -connection:failedToOpen: delegate method wasn't being called.
TCP/TCPConnection.m
     1.1 --- a/TCP/TCPConnection.m	Wed Jun 04 21:09:45 2008 -0700
     1.2 +++ b/TCP/TCPConnection.m	Tue Jun 10 16:14:20 2008 -0700
     1.3 @@ -255,8 +255,12 @@
     1.4  {
     1.5      if( _status != kTCP_Closed && _status != kTCP_Disconnected ) {
     1.6          LogTo(TCP,@"%@ is now closed",self);
     1.7 -        self.status = (_status==kTCP_Closing ?kTCP_Closed :kTCP_Disconnected);
     1.8 -        [self tellDelegate: @selector(connectionDidClose:) withObject: nil];
     1.9 +        TCPConnectionStatus prevStatus = _status;
    1.10 +        self.status = (prevStatus==kTCP_Closing ?kTCP_Closed :kTCP_Disconnected);
    1.11 +        if( prevStatus==kTCP_Opening )
    1.12 +            [self tellDelegate: @selector(connection:failedToOpen:) withObject: self.error];
    1.13 +        else
    1.14 +            [self tellDelegate: @selector(connectionDidClose:) withObject: nil];
    1.15      }
    1.16      [NSObject cancelPreviousPerformRequestsWithTarget: self
    1.17                                               selector: @selector(_closeTimeoutExpired)