Skip to content
This repository was archived by the owner on Dec 2, 2024. It is now read-only.

Commit 10d492a

Browse files
committed
Adjust to ObjFW changes
1 parent 5af409d commit 10d492a

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/SSLSocket.m

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -355,20 +355,24 @@ - (size_t)lowlevelReadIntoBuffer: (void *)buffer
355355
- (void)lowlevelWriteBuffer: (const void *)buffer
356356
length: (size_t)length
357357
{
358-
if (length > INT_MAX)
359-
@throw [OFOutOfRangeException exception];
358+
int bytesWritten;
360359

361360
if (_socket == INVALID_SOCKET)
362361
@throw [OFNotOpenException exceptionWithObject: self];
363362

364-
if (_atEndOfStream)
363+
if (length > INT_MAX)
364+
@throw [OFOutOfRangeException exception];
365+
366+
if ((bytesWritten = SSL_write(_SSL, buffer, (int)length)) < 0)
365367
@throw [OFWriteFailedException exceptionWithObject: self
366368
requestedLength: length
367-
errNo: ENOTCONN];
369+
bytesWritten: 0
370+
errNo: 0];
368371

369-
if (SSL_write(_SSL, buffer, (int)length) < length)
372+
if ((size_t)bytesWritten != length)
370373
@throw [OFWriteFailedException exceptionWithObject: self
371374
requestedLength: length
375+
bytesWritten: bytesWritten
372376
errNo: 0];
373377
}
374378

0 commit comments

Comments
 (0)