Index: src/OFStreamSocket.m ================================================================== --- src/OFStreamSocket.m +++ src/OFStreamSocket.m @@ -10,10 +10,11 @@ */ #include "config.h" #include +#include #include #include #ifndef _WIN32 # include @@ -24,10 +25,14 @@ #import "OFExceptions.h" #ifndef INVALID_SOCKET # define INVALID_SOCKET -1 #endif + +#ifdef _WIN32 +# define close(sock) closesocket(sock) +#endif @implementation OFStreamSocket #ifdef _WIN32 + (void)initialize { @@ -122,6 +127,18 @@ - (int)fileDescriptor { return sock; } + +- (void)close +{ + if (sock == INVALID_SOCKET) + @throw [OFNotConnectedException newWithClass: isa]; + + close(sock); + + sock = INVALID_SOCKET; + eos = NO; + listening = NO; +} @end Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -416,17 +416,11 @@ assert(0); } - (void)close { - if (sock == INVALID_SOCKET) - @throw [OFNotConnectedException newWithClass: isa]; - - close(sock); - sock = INVALID_SOCKET; - listening = NO; - eos = NO; + [super close]; [self freeMemory: sockAddr]; sockAddr = NULL; sockAddrLen = 0; }