@@ -1,7 +1,7 @@ /* - * Copyright (c) 2008-2022 Jonathan Schleifer + * Copyright (c) 2008-2024 Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in @@ -17,11 +17,11 @@ #include #import "OFSecureTransportTLSStream.h" -#import "OFAlreadyConnectedException.h" +#import "OFAlreadyOpenException.h" #import "OFNotOpenException.h" #import "OFReadFailedException.h" #import "OFTLSHandshakeFailedException.h" #import "OFWriteFailedException.h" @@ -166,19 +166,17 @@ errNo: 0]; return bytesWritten; } -- (bool)hasDataInReadBuffer +- (bool)lowlevelHasDataInReadBuffer { size_t bufferSize; - if (SSLGetBufferedReadSize(_context, &bufferSize) == noErr && - bufferSize > 0) - return true; - - return super.hasDataInReadBuffer; + return (_underlyingStream.hasDataInReadBuffer || + (SSLGetBufferedReadSize(_context, &bufferSize) == noErr && + bufferSize > 0)); } - (void)asyncPerformClientHandshakeWithHost: (OFString *)host runLoopMode: (OFRunLoopMode)runLoopMode { @@ -186,11 +184,11 @@ OFTLSStreamErrorCodeInitializationFailed; id exception = nil; OSStatus status; if (_context != NULL) - @throw [OFAlreadyConnectedException exceptionWithSocket: self]; + @throw [OFAlreadyOpenException exceptionWithObject: self]; #ifdef HAVE_SSLCREATECONTEXT if ((_context = SSLCreateContext(kCFAllocatorDefault, kSSLClientSide, kSSLStreamType)) == NULL) #else