aboutsummaryrefslogtreecommitdiff
path: root/src/server/worldserver
diff options
context:
space:
mode:
authorSpp <none@none>2010-12-06 02:07:53 +0100
committerSpp <none@none>2010-12-06 02:07:53 +0100
commit408fce1de69249b82cc042cb31f3fd16983c7e81 (patch)
treef4b99f386821e70f155d9aa61b70cfb1f2d3d825 /src/server/worldserver
parente226c4ac344d06c7abbd6f04725ced2b33606349 (diff)
Core: Some optimizations
- Declare some functions const - Fix some mem leak - Fix some resource leak - Remove unused variables and functions - Remove duplicate functions - Reduce the scope of some variables - Remove unused file --HG-- branch : trunk
Diffstat (limited to 'src/server/worldserver')
-rwxr-xr-xsrc/server/worldserver/RemoteAccess/RASocket.cpp15
-rwxr-xr-xsrc/server/worldserver/TCSoap/TCSoap.cpp9
-rwxr-xr-xsrc/server/worldserver/TCSoap/TCSoap.h2
3 files changed, 8 insertions, 18 deletions
diff --git a/src/server/worldserver/RemoteAccess/RASocket.cpp b/src/server/worldserver/RemoteAccess/RASocket.cpp
index ca80c3cbed0..452b94251ac 100755
--- a/src/server/worldserver/RemoteAccess/RASocket.cpp
+++ b/src/server/worldserver/RemoteAccess/RASocket.cpp
@@ -35,16 +35,11 @@
}
/// RASocket constructor
-RASocket::RASocket(ISocketHandler &h): TcpSocket(h)
+RASocket::RASocket(ISocketHandler &h): TcpSocket(h), szLogin(""), iInputLength(0),
+bSecure(sConfig.GetBoolDefault("RA.Secure", true)), iMinLevel(sConfig.GetIntDefault("RA.MinLevel", 3)),
+stage(NONE)
{
-
- ///- Get the config parameters
- bSecure = sConfig.GetBoolDefault( "RA.Secure", true );
- iMinLevel = sConfig.GetIntDefault( "RA.MinLevel", 3 );
-
- ///- Initialize buffer and data
- iInputLength=0;
- stage=NONE;
+ *buff = '\0';
}
/// RASocket destructor
@@ -197,7 +192,7 @@ void RASocket::OnRead()
break;
///<li> If user is logged, parse and execute the command
case OK:
- if (strlen(buff))
+ if (*buff != '\0')
{
sLog.outRemote("Got '%s' cmd.\n",buff);
SetDeleteByHandler(false);
diff --git a/src/server/worldserver/TCSoap/TCSoap.cpp b/src/server/worldserver/TCSoap/TCSoap.cpp
index 266fbd1eeb8..eaf5f8c41ff 100755
--- a/src/server/worldserver/TCSoap/TCSoap.cpp
+++ b/src/server/worldserver/TCSoap/TCSoap.cpp
@@ -28,18 +28,15 @@ void TCSoapRunnable::run()
pool.activate (THR_NEW_LWP | THR_JOINABLE, POOL_SIZE);
struct soap soap;
- int m, s;
soap_init(&soap);
soap_set_imode(&soap, SOAP_C_UTFSTRING);
soap_set_omode(&soap, SOAP_C_UTFSTRING);
- m = soap_bind(&soap, m_host.c_str(), m_port, 100);
// check every 3 seconds if world ended
soap.accept_timeout = 3;
-
soap.recv_timeout = 5;
soap.send_timeout = 5;
- if (m < 0)
+ if (soap_bind(&soap, m_host.c_str(), m_port, 100) < 0)
{
sLog.outError("TCSoap: couldn't bind to %s:%d", m_host.c_str(), m_port);
exit(-1);
@@ -49,9 +46,7 @@ void TCSoapRunnable::run()
while(!World::IsStopped())
{
- s = soap_accept(&soap);
-
- if (s < 0)
+ if (soap_accept(&soap) < 0)
continue; // ran into an accept timeout
sLog.outDebug("TCSoap: accepted connection from IP=%d.%d.%d.%d", (int)(soap.ip>>24)&0xFF, (int)(soap.ip>>16)&0xFF, (int)(soap.ip>>8)&0xFF, (int)soap.ip&0xFF);
diff --git a/src/server/worldserver/TCSoap/TCSoap.h b/src/server/worldserver/TCSoap/TCSoap.h
index c3cb06512b3..ec6d275a3ae 100755
--- a/src/server/worldserver/TCSoap/TCSoap.h
+++ b/src/server/worldserver/TCSoap/TCSoap.h
@@ -97,7 +97,7 @@ class SOAPCommand
m_success = val;
}
- bool hasCommandSucceeded()
+ bool hasCommandSucceeded() const
{
return m_success;
}