Don't class-swizzle to call close on super.

This commit is contained in:
Jonathan Schleifer 2013-02-14 00:27:13 +01:00
parent eff94d1c96
commit 80b2cd676d
2 changed files with 9 additions and 12 deletions

View file

@ -43,8 +43,8 @@
- initWithSocket: (OFTCPSocket*)socket - initWithSocket: (OFTCPSocket*)socket
privateKeyFile: (OFString*)privateKeyFile privateKeyFile: (OFString*)privateKeyFile
certificateFile: (OFString*)certificateFile; certificateFile: (OFString*)certificateFile;
/* Change the return type */ - (void)SSL_super_close;
- (SSLSocket*)accept; - (SSLSocket*)accept; /* Changes the return type */
- (void)setPrivateKeyFile: (OFString*)file; - (void)setPrivateKeyFile: (OFString*)file;
- (OFString*)privateKeyFile; - (OFString*)privateKeyFile;
- (void)setCertificateFile: (OFString*)file; - (void)setCertificateFile: (OFString*)file;

View file

@ -215,11 +215,7 @@ 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)) {
/* We only want to close the OFTCPSocket */ [client SSL_super_close];
object_setClass(client, [OFTCPSocket class]);
[client close];
object_setClass(client, object_getClass(self));
@throw [OFAcceptFailedException exceptionWithClass: [self class] @throw [OFAcceptFailedException exceptionWithClass: [self class]
socket: self]; socket: self];
} }
@ -234,11 +230,7 @@ locking_callback(int mode, int n, const char *file, int line)
SSL_FILETYPE_PEM) || !SSL_use_certificate_file(client->_SSL, SSL_FILETYPE_PEM) || !SSL_use_certificate_file(client->_SSL,
[_certificateFile cStringWithEncoding: OF_STRING_ENCODING_NATIVE], [_certificateFile cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
SSL_FILETYPE_PEM) || SSL_accept(client->_SSL) != 1) { SSL_FILETYPE_PEM) || SSL_accept(client->_SSL) != 1) {
/* We only want to close the OFTCPSocket */ [client SSL_super_close];
object_setClass(client, [OFTCPSocket class]);
[client close];
object_setClass(client, object_getClass(self));
@throw [OFAcceptFailedException exceptionWithClass: [self class] @throw [OFAcceptFailedException exceptionWithClass: [self class]
socket: self]; socket: self];
} }
@ -254,6 +246,11 @@ locking_callback(int mode, int n, const char *file, int line)
[super close]; [super close];
} }
- (void)SSL_super_close
{
[super close];
}
- (size_t)lowlevelReadIntoBuffer: (void*)buffer - (size_t)lowlevelReadIntoBuffer: (void*)buffer
length: (size_t)length length: (size_t)length
{ {