summaryrefslogtreecommitdiff
path: root/src/net/ea/network.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-02 14:05:30 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-02 14:05:30 +0300
commit962f182fcc989ec587282e44f889188ce241ba31 (patch)
treeda100971ec4952d0c56cb404862099c670bcfe0e /src/net/ea/network.cpp
parent4df121e6dcdf53436f50ce81dd60096ce0138a2c (diff)
downloadmanaverse-962f182fcc989ec587282e44f889188ce241ba31.tar.gz
manaverse-962f182fcc989ec587282e44f889188ce241ba31.tar.bz2
manaverse-962f182fcc989ec587282e44f889188ce241ba31.tar.xz
manaverse-962f182fcc989ec587282e44f889188ce241ba31.zip
Add const to more classes.
Diffstat (limited to 'src/net/ea/network.cpp')
-rw-r--r--src/net/ea/network.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp
index fc50c0971..679ff450d 100644
--- a/src/net/ea/network.cpp
+++ b/src/net/ea/network.cpp
@@ -44,7 +44,7 @@ const unsigned int BUFFER_LIMIT = 930000;
int networkThread(void *data)
{
- Network *network = static_cast<Network*>(data);
+ Network *const network = static_cast<Network *const>(data);
if (!network || !network->realConnect())
return -1;
@@ -62,11 +62,12 @@ Network::Network() :
mOutSize(0),
mToSkip(0),
mState(IDLE),
- mWorkerThread(nullptr)
+ mWorkerThread(nullptr),
+ mMutex(SDL_CreateMutex()),
+ mSleep(config.getIntValue("networksleep"))
{
SDLNet_Init();
- mMutex = SDL_CreateMutex();
}
Network::~Network()
@@ -135,9 +136,8 @@ void Network::disconnect()
// need call SDLNet_TCP_DelSocket?
SDLNet_TCP_Close(mSocket);
mSocket = nullptr;
- int sleep = config.getIntValue("networksleep");
- if (sleep > 0)
- SDL_Delay(sleep);
+ if (mSleep > 0)
+ SDL_Delay(mSleep);
}
}
@@ -237,7 +237,8 @@ void Network::receive()
{
// TODO Try to get this to block all the time while still being able
// to escape the loop
- int numReady = SDLNet_CheckSockets(set, (static_cast<uint32_t>(500)));
+ const int numReady = SDLNet_CheckSockets(
+ set, (static_cast<uint32_t>(500)));
int ret;
switch (numReady)
{