Index: src/OFTLSStream.h ================================================================== --- src/OFTLSStream.h +++ src/OFTLSStream.h @@ -63,28 +63,28 @@ * Subclasses need to override @ref lowlevelReadIntoBuffer:length:, * @ref lowlevelWriteBuffer:length: and * @ref asyncPerformClientHandshakeWithHost:runLoopMode:. The method * @ref hasDataInReadBuffer should be overridden to return `true` if the TLS * stream has cached unprocessed data internally, while returning - * `self.wrappedStream.hasDataInReadBuffer` if it does not have any unprocessed - * data. In order to get access to the wrapped stream, @ref wrappedStream can - * be used. + * `self.underlyingStream.hasDataInReadBuffer` if it does not have any + * unprocessed data. In order to get access to the underlying stream, + * @ref underlyingStream can be used. */ @interface OFTLSStream: OFStream { OFStream - *_wrappedStream; + *_underlyingStream; bool _verifiesCertificates; OF_RESERVE_IVARS(OFTLSStream, 4) } /** - * @brief The wrapped stream. + * @brief The underlying stream. */ @property (readonly, nonatomic) OFStream *wrappedStream; + OFReadyForWritingObserving> *underlyingStream; /** * @brief The delegate for asynchronous operations on the stream. * * @note The delegate is retained for as long as asynchronous operations are Index: src/OFTLSStream.m ================================================================== --- src/OFTLSStream.m +++ src/OFTLSStream.m @@ -70,11 +70,11 @@ _exception = [exception retain]; } @end @implementation OFTLSStream -@synthesize wrappedStream = _wrappedStream; +@synthesize underlyingStream = _underlyingStream; @dynamic delegate; @synthesize verifiesCertificates = _verifiesCertificates; + (instancetype)alloc { @@ -104,11 +104,11 @@ OFReadyForWritingObserving> *)stream { self = [super init]; @try { - _wrappedStream = [stream retain]; + _underlyingStream = [stream retain]; _verifiesCertificates = true; } @catch (id e) { [self release]; @throw e; } @@ -116,19 +116,19 @@ return self; } - (void)dealloc { - [_wrappedStream release]; + [_underlyingStream release]; [super dealloc]; } - (void)close { - [_wrappedStream release]; - _wrappedStream = nil; + [_underlyingStream release]; + _underlyingStream = nil; [super close]; } - (size_t)lowlevelReadIntoBuffer: (void *)buffer length: (size_t)length @@ -142,26 +142,26 @@ } - (bool)hasDataInReadBuffer { return (super.hasDataInReadBuffer || - _wrappedStream.hasDataInReadBuffer); + _underlyingStream.hasDataInReadBuffer); } - (bool)lowlevelIsAtEndOfStream { - return _wrappedStream.atEndOfStream; + return _underlyingStream.atEndOfStream; } - (int)fileDescriptorForReading { - return _wrappedStream.fileDescriptorForReading; + return _underlyingStream.fileDescriptorForReading; } - (int)fileDescriptorForWriting { - return _wrappedStream.fileDescriptorForWriting; + return _underlyingStream.fileDescriptorForWriting; } - (void)asyncPerformClientHandshakeWithHost: (OFString *)host { [self asyncPerformClientHandshakeWithHost: host Index: src/tls/OFGnuTLSTLSStream.m ================================================================== --- src/tls/OFGnuTLSTLSStream.m +++ src/tls/OFGnuTLSTLSStream.m @@ -35,18 +35,18 @@ readFunc(gnutls_transport_ptr_t transport, void *buffer, size_t length) { OFGnuTLSTLSStream *stream = (OFGnuTLSTLSStream *)transport; @try { - length = [stream.wrappedStream readIntoBuffer: buffer - length: length]; + length = [stream.underlyingStream readIntoBuffer: buffer + length: length]; } @catch (OFReadFailedException *e) { gnutls_transport_set_errno(stream->_session, e.errNo); return -1; } - if (length == 0 && !stream.wrappedStream.atEndOfStream) { + if (length == 0 && !stream.underlyingStream.atEndOfStream) { gnutls_transport_set_errno(stream->_session, EWOULDBLOCK); return -1; } return length; @@ -56,11 +56,11 @@ writeFunc(gnutls_transport_ptr_t transport, const void *buffer, size_t length) { OFGnuTLSTLSStream *stream = (OFGnuTLSTLSStream *)transport; @try { - [stream.wrappedStream writeBuffer: buffer length: length]; + [stream.underlyingStream writeBuffer: buffer length: length]; } @catch (OFWriteFailedException *e) { gnutls_transport_set_errno(stream->_session, e.errNo); if (e.errNo == EWOULDBLOCK) return e.bytesWritten; @@ -92,11 +92,11 @@ OFReadyForWritingObserving> *)stream { self = [super initWithStream: stream]; @try { - _wrappedStream.delegate = self; + _underlyingStream.delegate = self; } @catch (id e) { [self release]; @throw e; } @@ -236,17 +236,17 @@ status = gnutls_handshake(_session); if (status == GNUTLS_E_INTERRUPTED || status == GNUTLS_E_AGAIN) { if (gnutls_record_get_direction(_session) == 1) - [_wrappedStream + [_underlyingStream asyncWriteData: [OFData dataWithItems: "" count: 0] runLoopMode: runLoopMode]; else - [_wrappedStream asyncReadIntoBuffer: (void *)"" - length: 0 - runLoopMode: runLoopMode]; + [_underlyingStream asyncReadIntoBuffer: (void *)"" + length: 0 + runLoopMode: runLoopMode]; [_delegate retain]; return; } @@ -279,12 +279,12 @@ if (gnutls_record_get_direction(_session) == 1) { OFData *data = [OFData dataWithItems: "" count: 0]; OFRunLoopMode runLoopMode = [OFRunLoop currentRunLoop].currentMode; - [_wrappedStream asyncWriteData: data - runLoopMode: runLoopMode]; + [_underlyingStream asyncWriteData: data + runLoopMode: runLoopMode]; return false; } else return true; } @@ -321,11 +321,11 @@ if (gnutls_record_get_direction(_session) == 1) return data; else { OFRunLoopMode runLoopMode = [OFRunLoop currentRunLoop].currentMode; - [_wrappedStream + [_underlyingStream asyncReadIntoBuffer: (void *)"" length: 0 runLoopMode: runLoopMode]; return nil; } Index: src/tls/OFSecureTransportTLSStream.m ================================================================== --- src/tls/OFSecureTransportTLSStream.m +++ src/tls/OFSecureTransportTLSStream.m @@ -32,11 +32,11 @@ { bool incomplete; size_t length; @try { - length = [((OFTLSStream *)connection).wrappedStream + length = [((OFTLSStream *)connection).underlyingStream readIntoBuffer: data length: *dataLength]; } @catch (OFReadFailedException *e) { if (e.errNo == EWOULDBLOCK) { *dataLength = 0; @@ -54,11 +54,11 @@ static OSStatus writeFunc(SSLConnectionRef connection, const void *data, size_t *dataLength) { @try { - [((OFTLSStream *)connection).wrappedStream + [((OFTLSStream *)connection).underlyingStream writeBuffer: data length: *dataLength]; } @catch (OFWriteFailedException *e) { *dataLength = e.bytesWritten; @@ -89,11 +89,11 @@ OFReadyForWritingObserving> *)stream { self = [super initWithStream: stream]; @try { - _wrappedStream.delegate = self; + _underlyingStream.delegate = self; } @catch (id e) { [self release]; @throw e; } @@ -217,13 +217,13 @@ * Secure Transport does not tell us whether it's blocked on * reading or writing. Waiting for the stream to be either * readable or writable doesn't work either, as the stream is * almost always at least ready for one of the two. */ - [_wrappedStream asyncReadIntoBuffer: (void *)"" - length: 0 - runLoopMode: runLoopMode]; + [_underlyingStream asyncReadIntoBuffer: (void *)"" + length: 0 + runLoopMode: runLoopMode]; [_delegate retain]; return; } if (status != noErr)