Index: src/SSLSocket.h ================================================================== --- src/SSLSocket.h +++ src/SSLSocket.h @@ -41,12 +41,12 @@ - initWithSocket: (OFTCPSocket*)socket; - initWithSocket: (OFTCPSocket*)socket privateKeyFile: (OFString*)privateKeyFile certificateFile: (OFString*)certificateFile; -/* Change the return type */ -- (SSLSocket*)accept; +- (void)SSL_super_close; +- (SSLSocket*)accept; /* Changes the return type */ - (void)setPrivateKeyFile: (OFString*)file; - (OFString*)privateKeyFile; - (void)setCertificateFile: (OFString*)file; - (OFString*)certificateFile; - (void)setRequestsClientCertificates: (BOOL)enabled; Index: src/SSLSocket.m ================================================================== --- src/SSLSocket.m +++ src/SSLSocket.m @@ -213,15 +213,11 @@ { SSLSocket *client = (SSLSocket*)[super accept]; if ((client->_SSL = SSL_new(ctx)) == NULL || !SSL_set_fd(client->_SSL, client->_socket)) { - /* We only want to close the OFTCPSocket */ - object_setClass(client, [OFTCPSocket class]); - [client close]; - object_setClass(client, object_getClass(self)); - + [client SSL_super_close]; @throw [OFAcceptFailedException exceptionWithClass: [self class] socket: self]; } if (_requestsClientCertificates) @@ -232,15 +228,11 @@ if (!SSL_use_PrivateKey_file(client->_SSL, [_privateKeyFile cStringWithEncoding: OF_STRING_ENCODING_NATIVE], SSL_FILETYPE_PEM) || !SSL_use_certificate_file(client->_SSL, [_certificateFile cStringWithEncoding: OF_STRING_ENCODING_NATIVE], SSL_FILETYPE_PEM) || SSL_accept(client->_SSL) != 1) { - /* We only want to close the OFTCPSocket */ - object_setClass(client, [OFTCPSocket class]); - [client close]; - object_setClass(client, object_getClass(self)); - + [client SSL_super_close]; @throw [OFAcceptFailedException exceptionWithClass: [self class] socket: self]; } return client; @@ -249,10 +241,15 @@ - (void)close { if (_SSL != NULL) SSL_shutdown(_SSL); + [super close]; +} + +- (void)SSL_super_close +{ [super close]; } - (size_t)lowlevelReadIntoBuffer: (void*)buffer length: (size_t)length