TCP/TCPConnection.m
changeset 19 16454d63d4c2
parent 18 3be241de1630
child 20 02224e981209
     1.1 --- a/TCP/TCPConnection.m	Thu Jun 19 16:22:05 2008 -0700
     1.2 +++ b/TCP/TCPConnection.m	Mon Jun 23 14:02:31 2008 -0700
     1.3 @@ -247,7 +247,24 @@
     1.4          [self disconnect];
     1.5  }
     1.6  
     1.7 +- (void) _stopCloseTimer
     1.8 +{
     1.9 +    [NSObject cancelPreviousPerformRequestsWithTarget: self selector: @selector(_closeTimeoutExpired) object: nil];
    1.10 +}
    1.11  
    1.12 +- (void) _unclose
    1.13 +{
    1.14 +    if( _status == kTCP_Closing ) {
    1.15 +        LogTo(TCP,@"%@: _unclose!",self);
    1.16 +        [_reader _unclose];
    1.17 +        [_writer _unclose];
    1.18 +        [self _stopCloseTimer];
    1.19 +        self.status = kTCP_Open;
    1.20 +    }
    1.21 +}
    1.22 +
    1.23 +
    1.24 +/** Subclasses can override this to customize what happens when -close is called. */
    1.25  - (void) _beginClose
    1.26  {
    1.27      [_reader close];
    1.28 @@ -278,9 +295,7 @@
    1.29          else
    1.30              [self tellDelegate: @selector(connectionDidClose:) withObject: nil];
    1.31      }
    1.32 -    [NSObject cancelPreviousPerformRequestsWithTarget: self
    1.33 -                                             selector: @selector(_closeTimeoutExpired)
    1.34 -                                               object: nil];
    1.35 +    [self _stopCloseTimer];
    1.36      [self _stopOpenTimer];
    1.37      [sAllConnections removeObjectIdenticalTo: self];
    1.38  }