TCP/TCPConnection.m
changeset 32 b3254a2f6d6c
parent 26 cb9cdf247239
child 33 a9c59b0acbbc
     1.1 --- a/TCP/TCPConnection.m	Wed Apr 22 16:45:39 2009 -0700
     1.2 +++ b/TCP/TCPConnection.m	Wed Apr 29 13:57:10 2009 -0700
     1.3 @@ -111,14 +111,16 @@
     1.4      CFWriteStreamRef writeStream = NULL;
     1.5      CFStreamCreatePairWithSocket(kCFAllocatorDefault, socket, &readStream, &writeStream);
     1.6      self = [self _initWithAddress: [IPAddress addressOfSocket: socket] 
     1.7 -                      inputStream: (NSInputStream*)readStream
     1.8 -                     outputStream: (NSOutputStream*)writeStream];
     1.9 +                      inputStream: (NSInputStream*)CFMakeCollectable(readStream)
    1.10 +                     outputStream: (NSOutputStream*)CFMakeCollectable(writeStream)];
    1.11      if( self ) {
    1.12          _isIncoming = YES;
    1.13          _server = [listener retain];
    1.14          CFReadStreamSetProperty(readStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue);
    1.15          CFWriteStreamSetProperty(writeStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue);
    1.16      }
    1.17 +    if(readStream) CFRelease(readStream);
    1.18 +    if(writeStream) CFRelease(writeStream);
    1.19      return self;
    1.20  }    
    1.21