ObjFW  Diff

Differences From Artifact [d93e2e9a8c]:

To Artifact [4f42a57c0b]:


15
16
17
18
19
20
21

22
23
24
25
26
27
28

#include "config.h"

#include <errno.h>

#import "OFOpenSSLTLSStream.h"
#import "OFData.h"


#import "OFAlreadyOpenException.h"
#import "OFInitializationFailedException.h"
#import "OFNotOpenException.h"
#import "OFReadFailedException.h"
#import "OFTLSHandshakeFailedException.h"
#import "OFWriteFailedException.h"







>







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

#include "config.h"

#include <errno.h>

#import "OFOpenSSLTLSStream.h"
#import "OFData.h"
#import "OFStream+Private.h"

#import "OFAlreadyOpenException.h"
#import "OFInitializationFailedException.h"
#import "OFNotOpenException.h"
#import "OFReadFailedException.h"
#import "OFTLSHandshakeFailedException.h"
#import "OFWriteFailedException.h"
199
200
201
202
203
204
205


























206
207
208
209
210
211
212
- (bool)hasDataInReadBuffer
{
	if (SSL_pending(_SSL) > 0 || BIO_ctrl_pending(_readBIO) > 0)
		return true;

	return super.hasDataInReadBuffer;
}



























- (void)asyncPerformClientHandshakeWithHost: (OFString *)host
				runLoopMode: (OFRunLoopMode)runLoopMode
{
	static const OFTLSStreamErrorCode initFailedErrorCode =
	    OFTLSStreamErrorCodeInitializationFailed;
	id exception = nil;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
- (bool)hasDataInReadBuffer
{
	if (SSL_pending(_SSL) > 0 || BIO_ctrl_pending(_readBIO) > 0)
		return true;

	return super.hasDataInReadBuffer;
}

- (bool)of_isWaitingForDelimiter
{
	/* FIXME: There should be a non-private API for this. */

	/*
	 * If we still have pending data in the SSL connection, we haven't
	 * processed it yet to see if our delimiter is in there. So return
	 * false here, as that will signal the stream as ready for reading,
	 * which in turn will cause a read and checking for the delimiter.
	 */
	if (SSL_pending(_SSL))
		return false;

	/*
	 * If we still have data in our read BIO, it hasn't been processed by
	 * OpenSSL yet. As we have no idea what's in there, return false to
	 * signal the stream as ready for reading, which in turn will cause a
	 * read to check for the delimiter and in turn make OpenSSL process the
	 * data in the read BIO.
	 */
	if (BIO_ctrl_pending(_readBIO) > 0)
		return false;

	return super.of_waitingForDelimiter;
}

- (void)asyncPerformClientHandshakeWithHost: (OFString *)host
				runLoopMode: (OFRunLoopMode)runLoopMode
{
	static const OFTLSStreamErrorCode initFailedErrorCode =
	    OFTLSStreamErrorCodeInitializationFailed;
	id exception = nil;