summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-01-14 01:08:04 +0300
committerAndrei Karas <akaras@inbox.ru>2014-01-14 01:08:04 +0300
commitc169dbdd1fc14f66890dcb6fba7ecf543067875d (patch)
treed39bf9211d34f13a2c0f2953dc1896c563f31bd1 /src/net
parent8e4f4e04ca61594e3dec31bad70eaf6cdf86ad8f (diff)
downloadmanaverse-c169dbdd1fc14f66890dcb6fba7ecf543067875d.tar.gz
manaverse-c169dbdd1fc14f66890dcb6fba7ecf543067875d.tar.bz2
manaverse-c169dbdd1fc14f66890dcb6fba7ecf543067875d.tar.xz
manaverse-c169dbdd1fc14f66890dcb6fba7ecf543067875d.zip
Use thread safe logging in threads.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/download.cpp4
-rw-r--r--src/net/ea/network.cpp16
-rw-r--r--src/net/sdltcpnet.cpp4
3 files changed, 12 insertions, 12 deletions
diff --git a/src/net/download.cpp b/src/net/download.cpp
index e9b6dd6d7..d986fa232 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -302,7 +302,7 @@ int Download::downloadThread(void *ptr)
{
if (d->mError)
{
- logger->log("curl error %d: %s host: %s",
+ logger->log_r("curl error %d: %s host: %s",
res, d->mError, d->mUrl.c_str());
}
break;
@@ -347,7 +347,7 @@ int Download::downloadThread(void *ptr)
// Remove the corrupted file
::remove(d->mFileName.c_str());
- logger->log("Checksum for file %s failed: (%lx/%lx)",
+ logger->log_r("Checksum for file %s failed: (%lx/%lx)",
d->mFileName.c_str(),
adler, d->mAdler);
attempts++;
diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp
index 4ca79b87e..c5ed9de57 100644
--- a/src/net/ea/network.cpp
+++ b/src/net/ea/network.cpp
@@ -201,10 +201,10 @@ bool Network::realConnect()
_("Unable to resolve host \"")).append(
mServer.hostname).append("\".");
setError(errorMessage);
- logger->log("TcpNet::ResolveHost: %s", errorMessage.c_str());
+ logger->log_r("TcpNet::ResolveHost: %s", errorMessage.c_str());
return false;
}
- logger->log("using alt host name: %s", mServer.althostname.c_str());
+ logger->log_r("using alt host name: %s", mServer.althostname.c_str());
}
mState = CONNECTING;
@@ -212,12 +212,12 @@ bool Network::realConnect()
mSocket = TcpNet::open(&ipAddress);
if (!mSocket)
{
- logger->log("Error in TcpNet::open(): %s", TcpNet::getError());
+ logger->log_r("Error in TcpNet::open(): %s", TcpNet::getError());
setError(TcpNet::getError());
return false;
}
- logger->log("Network::Started session with %s:%i",
+ logger->log_r("Network::Started session with %s:%i",
ipToString(ipAddress.host), ipAddress.port);
mState = CONNECTED;
@@ -248,7 +248,7 @@ void Network::receive()
switch (numReady)
{
case -1:
- logger->log1("Error: TcpNet::checkSockets");
+ logger->log_r("Error: TcpNet::checkSockets");
break;
// FALLTHROUGH
case 0:
@@ -272,7 +272,7 @@ void Network::receive()
{
// We got disconnected
mState = IDLE;
- logger->log1("Disconnected.");
+ logger->log_r("Disconnected.");
}
else if (ret < 0)
{
@@ -315,14 +315,14 @@ void Network::receive()
}
if (TcpNet::delSocket(set, mSocket) == -1)
- logger->log("Error in TcpNet::delSocket(): %s", TcpNet::getError());
+ logger->log_r("Error in TcpNet::delSocket(): %s", TcpNet::getError());
TcpNet::freeSocketSet(set);
}
void Network::setError(const std::string &error)
{
- logger->log("Network error: %s", error.c_str());
+ logger->log_r("Network error: %s", error.c_str());
mError = error;
mState = NET_ERROR;
}
diff --git a/src/net/sdltcpnet.cpp b/src/net/sdltcpnet.cpp
index c07ba569b..7530e0f53 100644
--- a/src/net/sdltcpnet.cpp
+++ b/src/net/sdltcpnet.cpp
@@ -106,14 +106,14 @@ TcpNet::Socket TcpNet::open(IPaddress *const ip)
if (setsockopt(hack->channel, IPPROTO_TCP,
TCP_THIN_LINEAR_TIMEOUTS, &val, sizeof(val)))
{
- logger->log1("error on set TCP_THIN_LINEAR_TIMEOUTS");
+ logger->log_r("error on set TCP_THIN_LINEAR_TIMEOUTS");
}
#endif
#ifdef TCP_THIN_DUPACK
if (setsockopt(hack->channel, IPPROTO_TCP,
TCP_THIN_DUPACK, &val, sizeof(val)))
{
- logger->log1("error on set TCP_THIN_DUPACK");
+ logger->log_r("error on set TCP_THIN_DUPACK");
}
#endif
}