Adjust to ObjFW changes

This commit is contained in:
Jonathan Schleifer 2015-03-01 20:49:50 +01:00
parent bffab74530
commit ba8365204b
No known key found for this signature in database
GPG key ID: 33E61C63EB4AE7B5

View file

@ -185,7 +185,9 @@ locking_callback(int mode, int n, const char *file, int line)
if ((client->_SSL = SSL_new(ctx)) == NULL || if ((client->_SSL = SSL_new(ctx)) == NULL ||
!SSL_set_fd(client->_SSL, client->_socket)) { !SSL_set_fd(client->_SSL, client->_socket)) {
[client SSL_super_close]; [client SSL_super_close];
@throw [OFAcceptFailedException exceptionWithSocket: self]; /* FIXME: Get a proper errno */
@throw [OFAcceptFailedException exceptionWithSocket: self
errNo: 0];
} }
if (_requestsClientCertificates) if (_requestsClientCertificates)
@ -201,7 +203,9 @@ locking_callback(int mode, int n, const char *file, int line)
[_certificateFile cStringWithEncoding: encoding], [_certificateFile cStringWithEncoding: encoding],
SSL_FILETYPE_PEM) || SSL_accept(client->_SSL) != 1) { SSL_FILETYPE_PEM) || SSL_accept(client->_SSL) != 1) {
[client SSL_super_close]; [client SSL_super_close];
@throw [OFAcceptFailedException exceptionWithSocket: self]; /* FIXME: Get a proper errno */
@throw [OFAcceptFailedException exceptionWithSocket: self
errNo: 0];
} }
return client; return client;
@ -231,19 +235,10 @@ locking_callback(int mode, int n, const char *file, int line)
if (_socket == INVALID_SOCKET) if (_socket == INVALID_SOCKET)
@throw [OFNotConnectedException exceptionWithSocket: self]; @throw [OFNotConnectedException exceptionWithSocket: self];
if (_atEndOfStream) { if (_atEndOfStream)
OFReadFailedException *e; @throw [OFReadFailedException exceptionWithObject: self
requestedLength: length
e = [OFReadFailedException exceptionWithObject: self errNo: ENOTCONN];
requestedLength: length];
#ifndef _WIN32
e->_errNo = ENOTCONN;
#else
e->_errNo = WSAENOTCONN;
#endif
@throw e;
}
if ((ret = SSL_read(_SSL, buffer, (int)length)) < 0) { if ((ret = SSL_read(_SSL, buffer, (int)length)) < 0) {
if (SSL_get_error(_SSL, ret) == SSL_ERROR_WANT_READ) if (SSL_get_error(_SSL, ret) == SSL_ERROR_WANT_READ)
@ -268,20 +263,10 @@ locking_callback(int mode, int n, const char *file, int line)
if (_socket == INVALID_SOCKET) if (_socket == INVALID_SOCKET)
@throw [OFNotConnectedException exceptionWithSocket: self]; @throw [OFNotConnectedException exceptionWithSocket: self];
if (_atEndOfStream) { if (_atEndOfStream)
OFWriteFailedException *e; @throw [OFWriteFailedException exceptionWithObject: self
requestedLength: length
e = [OFWriteFailedException exceptionWithObject: self errNo: ENOTCONN];
requestedLength: length];
#ifndef _WIN32
e->_errNo = ENOTCONN;
#else
e->_errNo = WSAENOTCONN;
#endif
@throw e;
}
if (SSL_write(_SSL, buffer, (int)length) < length) if (SSL_write(_SSL, buffer, (int)length) < length)
@throw [OFWriteFailedException exceptionWithObject: self @throw [OFWriteFailedException exceptionWithObject: self