diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-03-15 22:47:21 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-03-15 22:47:21 +0000 |
commit | 65ccfccfc1e35a2e65638aea61c46e4e51bd874e (patch) | |
tree | 231ccea34d7b44da1c45d8df5b927ddf18859a5c /src/net | |
parent | 0d7f2d306d2899571b6034ccd3de6e3a34c2193a (diff) | |
download | mana-65ccfccfc1e35a2e65638aea61c46e4e51bd874e.tar.gz mana-65ccfccfc1e35a2e65638aea61c46e4e51bd874e.tar.bz2 mana-65ccfccfc1e35a2e65638aea61c46e4e51bd874e.tar.xz mana-65ccfccfc1e35a2e65638aea61c46e4e51bd874e.zip |
Fixed connection not being shut down completely in case of an error.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/network.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/net/network.cpp b/src/net/network.cpp index 366d07d9..bd0e2444 100644 --- a/src/net/network.cpp +++ b/src/net/network.cpp @@ -91,6 +91,7 @@ int networkThread(void *data) } Network::Network(): + mSocket(0), mAddress(), mPort(0), mInBuffer(new char[BUFFER_SIZE]), mOutBuffer(new char[BUFFER_SIZE]), @@ -154,9 +155,6 @@ bool Network::connect(const std::string &address, short port) void Network::disconnect() { - if (mState != CONNECTED && mState != CONNECTING) - return; - mState = IDLE; if (mWorkerThread) @@ -164,7 +162,12 @@ void Network::disconnect() SDL_WaitThread(mWorkerThread, NULL); mWorkerThread = NULL; } - SDLNet_TCP_Close(mSocket); + + if (mSocket) + { + SDLNet_TCP_Close(mSocket); + mSocket = 0; + } } void Network::registerHandler(MessageHandler *handler) |