[11442] Cleanup codestyle in WorldSocketMgr.cpp & WorldSocketMgr.h

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Den 2011-05-08 20:00:34 +04:00 committed by VladimirMangos
parent d0a0479749
commit d98b9b9670
3 changed files with 97 additions and 114 deletions

View file

@ -52,7 +52,6 @@
class ReactorRunnable : protected ACE_Task_Base
{
public:
ReactorRunnable() :
m_Reactor (0),
m_Connections (0),
@ -124,7 +123,6 @@ class ReactorRunnable : protected ACE_Task_Base
}
protected:
void AddNewSockets()
{
ACE_GUARD (ACE_Thread_Mutex, Guard, m_NewSockets_Lock);
@ -225,8 +223,7 @@ WorldSocketMgr::~WorldSocketMgr ()
delete m_Acceptor;
}
int
WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
int WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
{
m_UseNoDelay = sConfig.GetBoolDefault ("Network.TcpNodelay", true);
@ -272,8 +269,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
return 0;
}
int
WorldSocketMgr::StartNetwork (ACE_UINT16 port, std::string& address)
int WorldSocketMgr::StartNetwork (ACE_UINT16 port, std::string& address)
{
m_addr = address;
m_port = port;
@ -287,8 +283,7 @@ WorldSocketMgr::StartNetwork (ACE_UINT16 port, std::string& address)
return 0;
}
void
WorldSocketMgr::StopNetwork ()
void WorldSocketMgr::StopNetwork()
{
if (m_Acceptor)
{
@ -307,8 +302,7 @@ WorldSocketMgr::StopNetwork ()
Wait();
}
void
WorldSocketMgr::Wait ()
void WorldSocketMgr::Wait()
{
if (m_NetThreadsCount != 0)
{
@ -317,16 +311,12 @@ WorldSocketMgr::Wait ()
}
}
int
WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
int WorldSocketMgr::OnSocketOpen(WorldSocket* sock)
{
// set some options here
if (m_SockOutKBuff >= 0)
{
if (sock->peer ().set_option (SOL_SOCKET,
SO_SNDBUF,
(void*) & m_SockOutKBuff,
sizeof (int)) == -1 && errno != ENOTSUP)
if (sock->peer().set_option(SOL_SOCKET, SO_SNDBUF, (void*)&m_SockOutKBuff, sizeof(int)) == -1 && errno != ENOTSUP)
{
sLog.outError ("WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF");
return -1;
@ -338,10 +328,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
// Set TCP_NODELAY.
if (m_UseNoDelay)
{
if (sock->peer ().set_option (ACE_IPPROTO_TCP,
TCP_NODELAY,
(void*)&ndoption,
sizeof (int)) == -1)
if (sock->peer().set_option(ACE_IPPROTO_TCP, TCP_NODELAY, (void*)&ndoption, sizeof (int)) == -1)
{
sLog.outError("WorldSocketMgr::OnSocketOpen: peer().set_option TCP_NODELAY errno = %s", ACE_OS::strerror(errno));
return -1;
@ -362,8 +349,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
return m_NetThreads[min].AddSocket (sock);
}
WorldSocketMgr*
WorldSocketMgr::Instance ()
WorldSocketMgr* WorldSocketMgr::Instance()
{
return ACE_Singleton<WorldSocketMgr, ACE_Thread_Mutex>::instance();
}

View file

@ -59,10 +59,8 @@ public:
private:
int OnSocketOpen(WorldSocket* sock);
int StartReactiveIO(ACE_UINT16 port, const char* address);
private:
WorldSocketMgr();
virtual ~WorldSocketMgr();
@ -81,6 +79,5 @@ private:
#define sWorldSocketMgr WorldSocketMgr::Instance()
#endif
/// @}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11441"
#define REVISION_NR "11442"
#endif // __REVISION_NR_H__