Index: src/SSLSocket.m ================================================================== --- src/SSLSocket.m +++ src/SSLSocket.m @@ -183,11 +183,13 @@ of_string_encoding_t encoding; if ((client->_SSL = SSL_new(ctx)) == NULL || !SSL_set_fd(client->_SSL, client->_socket)) { [client SSL_super_close]; - @throw [OFAcceptFailedException exceptionWithSocket: self]; + /* FIXME: Get a proper errno */ + @throw [OFAcceptFailedException exceptionWithSocket: self + errNo: 0]; } if (_requestsClientCertificates) SSL_set_verify(client->_SSL, SSL_VERIFY_PEER, NULL); @@ -199,11 +201,13 @@ cStringWithEncoding: encoding], SSL_FILETYPE_PEM) || !SSL_use_certificate_file(client->_SSL, [_certificateFile cStringWithEncoding: encoding], SSL_FILETYPE_PEM) || SSL_accept(client->_SSL) != 1) { [client SSL_super_close]; - @throw [OFAcceptFailedException exceptionWithSocket: self]; + /* FIXME: Get a proper errno */ + @throw [OFAcceptFailedException exceptionWithSocket: self + errNo: 0]; } return client; } @@ -229,23 +233,14 @@ @throw [OFOutOfRangeException exception]; if (_socket == INVALID_SOCKET) @throw [OFNotConnectedException exceptionWithSocket: self]; - if (_atEndOfStream) { - OFReadFailedException *e; - - e = [OFReadFailedException exceptionWithObject: self - requestedLength: length]; -#ifndef _WIN32 - e->_errNo = ENOTCONN; -#else - e->_errNo = WSAENOTCONN; -#endif - - @throw e; - } + if (_atEndOfStream) + @throw [OFReadFailedException exceptionWithObject: self + requestedLength: length + errNo: ENOTCONN]; if ((ret = SSL_read(_SSL, buffer, (int)length)) < 0) { if (SSL_get_error(_SSL, ret) == SSL_ERROR_WANT_READ) return 0; @@ -266,24 +261,14 @@ @throw [OFOutOfRangeException exception]; if (_socket == INVALID_SOCKET) @throw [OFNotConnectedException exceptionWithSocket: self]; - if (_atEndOfStream) { - OFWriteFailedException *e; - - e = [OFWriteFailedException exceptionWithObject: self - requestedLength: length]; - -#ifndef _WIN32 - e->_errNo = ENOTCONN; -#else - e->_errNo = WSAENOTCONN; -#endif - - @throw e; - } + if (_atEndOfStream) + @throw [OFWriteFailedException exceptionWithObject: self + requestedLength: length + errNo: ENOTCONN]; if (SSL_write(_SSL, buffer, (int)length) < length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length]; }