@@ -12,10 +12,12 @@ * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ +#define OF_TCP_SOCKET_M + #define __NO_EXT_QNX #include "config.h" #include @@ -269,10 +271,17 @@ of_resolver_result_t **results, **iter; if (_socket != INVALID_SOCKET) @throw [OFAlreadyConnectedException exceptionWithSocket: self]; + _listening = false; + + /* Make sure to clear the read buffer in case the socket is reused */ + [self freeMemory: _readBuffer]; + _readBuffer = NULL; + _readBufferLength = 0; + if (_SOCKS5Host != nil) { /* Connect to the SOCKS5 proxy instead */ host = _SOCKS5Host; port = _SOCKS5Port; } @@ -513,13 +522,6 @@ - (bool)isListening { return _listening; } - -- (void)close -{ - [super close]; - - _listening = false; -} @end