summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--src/net/network.cpp11
2 files changed, 12 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index bdac0234..bfe50df2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-03-15 Björn Steinbrink <B.Steinbrink@gmx.de>
+
+ * src/net/network.cpp: Fixed connection not being shut down completely
+ in case of an error.
+
2006-03-13 Eugenio Favalli <elvenprogrammer@gmail.com>
* src/main.cpp: Fixed skip update option.
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)