Adjust to ObjFW changes

This commit is contained in:
Jonathan Schleifer 2017-07-02 14:22:03 +02:00
parent 5af409d4a5
commit 10d492a94a
No known key found for this signature in database
GPG key ID: 28D65178B37F33E3

View file

@ -355,20 +355,24 @@ locking_callback(int mode, int n, const char *file, int line)
- (void)lowlevelWriteBuffer: (const void *)buffer
length: (size_t)length
{
if (length > INT_MAX)
@throw [OFOutOfRangeException exception];
int bytesWritten;
if (_socket == INVALID_SOCKET)
@throw [OFNotOpenException exceptionWithObject: self];
if (_atEndOfStream)
@throw [OFWriteFailedException exceptionWithObject: self
requestedLength: length
errNo: ENOTCONN];
if (length > INT_MAX)
@throw [OFOutOfRangeException exception];
if (SSL_write(_SSL, buffer, (int)length) < length)
if ((bytesWritten = SSL_write(_SSL, buffer, (int)length)) < 0)
@throw [OFWriteFailedException exceptionWithObject: self
requestedLength: length
bytesWritten: 0
errNo: 0];
if ((size_t)bytesWritten != length)
@throw [OFWriteFailedException exceptionWithObject: self
requestedLength: length
bytesWritten: bytesWritten
errNo: 0];
}