mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
Fixed english spelling in src/game/WorldSocket.h/cpp.
This commit is contained in:
parent
af556bae16
commit
d53b77cadf
2 changed files with 36 additions and 36 deletions
|
|
@ -261,7 +261,7 @@ int WorldSocket::handle_input (ACE_HANDLE)
|
||||||
if ((errno == EWOULDBLOCK) ||
|
if ((errno == EWOULDBLOCK) ||
|
||||||
(errno == EAGAIN))
|
(errno == EAGAIN))
|
||||||
{
|
{
|
||||||
return Update (); // interesting line ,isnt it ?
|
return Update (); // interesting line ,isn't it ?
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_LOG ("WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno));
|
DEBUG_LOG ("WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno));
|
||||||
|
|
@ -460,20 +460,20 @@ int WorldSocket::handle_input_missing_data (void)
|
||||||
{
|
{
|
||||||
if (m_Header.space () > 0)
|
if (m_Header.space () > 0)
|
||||||
{
|
{
|
||||||
//need to recieve the header
|
//need to receive the header
|
||||||
const size_t to_header = (message_block.length () > m_Header.space () ? m_Header.space () : message_block.length ());
|
const size_t to_header = (message_block.length () > m_Header.space () ? m_Header.space () : message_block.length ());
|
||||||
m_Header.copy (message_block.rd_ptr (), to_header);
|
m_Header.copy (message_block.rd_ptr (), to_header);
|
||||||
message_block.rd_ptr (to_header);
|
message_block.rd_ptr (to_header);
|
||||||
|
|
||||||
if (m_Header.space () > 0)
|
if (m_Header.space () > 0)
|
||||||
{
|
{
|
||||||
//couldnt recieve the whole header this time
|
// Couldn't receive the whole header this time.
|
||||||
ACE_ASSERT (message_block.length () == 0);
|
ACE_ASSERT (message_block.length () == 0);
|
||||||
errno = EWOULDBLOCK;
|
errno = EWOULDBLOCK;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//we just recieved nice new header
|
// We just received nice new header
|
||||||
if (handle_input_header () == -1)
|
if (handle_input_header () == -1)
|
||||||
{
|
{
|
||||||
ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN));
|
ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN));
|
||||||
|
|
@ -482,16 +482,16 @@ int WorldSocket::handle_input_missing_data (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Its possible on some error situations that this happens
|
// Its possible on some error situations that this happens
|
||||||
// for example on closing when epoll recieves more chunked data and stuff
|
// for example on closing when epoll receives more chunked data and stuff
|
||||||
// hope this is not hack ,as proper m_RecvWPct is asserted around
|
// hope this is not hack ,as proper m_RecvWPct is asserted around
|
||||||
if (!m_RecvWPct)
|
if (!m_RecvWPct)
|
||||||
{
|
{
|
||||||
sLog.outError ("Forsing close on input m_RecvWPct = NULL");
|
sLog.outError ("Forcing close on input m_RecvWPct = NULL");
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have full readed header, now check the data payload
|
// We have full read header, now check the data payload
|
||||||
if (m_RecvPct.space () > 0)
|
if (m_RecvPct.space () > 0)
|
||||||
{
|
{
|
||||||
//need more data in the payload
|
//need more data in the payload
|
||||||
|
|
@ -501,14 +501,14 @@ int WorldSocket::handle_input_missing_data (void)
|
||||||
|
|
||||||
if (m_RecvPct.space () > 0)
|
if (m_RecvPct.space () > 0)
|
||||||
{
|
{
|
||||||
//couldnt recieve the whole data this time
|
// Couldn't receive the whole data this time.
|
||||||
ACE_ASSERT (message_block.length () == 0);
|
ACE_ASSERT (message_block.length () == 0);
|
||||||
errno = EWOULDBLOCK;
|
errno = EWOULDBLOCK;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//just recieved fresh new payload
|
//just received fresh new payload
|
||||||
if (handle_input_payload () == -1)
|
if (handle_input_payload () == -1)
|
||||||
{
|
{
|
||||||
ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN));
|
ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN));
|
||||||
|
|
@ -570,7 +570,7 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
|
||||||
if (closing_)
|
if (closing_)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// dump recieved packet
|
// Dump received packet.
|
||||||
if (sWorldLog.LogWorld ())
|
if (sWorldLog.LogWorld ())
|
||||||
{
|
{
|
||||||
sWorldLog.Log ("CLIENT:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n",
|
sWorldLog.Log ("CLIENT:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n",
|
||||||
|
|
@ -635,7 +635,7 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
|
||||||
|
|
||||||
int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
|
int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
|
||||||
{
|
{
|
||||||
// NOTE: ATM the socket is singlethreaded, have this in mind ...
|
// NOTE: ATM the socket is singlethread, have this in mind ...
|
||||||
uint8 digest[20];
|
uint8 digest[20];
|
||||||
uint32 clientSeed;
|
uint32 clientSeed;
|
||||||
uint32 unk2;
|
uint32 unk2;
|
||||||
|
|
@ -924,7 +924,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket)
|
||||||
if (m_Session && m_Session->GetSecurity () == SEC_PLAYER)
|
if (m_Session && m_Session->GetSecurity () == SEC_PLAYER)
|
||||||
{
|
{
|
||||||
sLog.outError ("WorldSocket::HandlePing: Player kicked for "
|
sLog.outError ("WorldSocket::HandlePing: Player kicked for "
|
||||||
"overspeeded pings adress = %s",
|
"over-speed pings address = %s",
|
||||||
GetRemoteAddress ().c_str ());
|
GetRemoteAddress ().c_str ());
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -945,7 +945,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket)
|
||||||
{
|
{
|
||||||
sLog.outError ("WorldSocket::HandlePing: peer sent CMSG_PING, "
|
sLog.outError ("WorldSocket::HandlePing: peer sent CMSG_PING, "
|
||||||
"but is not authenticated or got recently kicked,"
|
"but is not authenticated or got recently kicked,"
|
||||||
" adress = %s",
|
" address = %s",
|
||||||
GetRemoteAddress ().c_str ());
|
GetRemoteAddress ().c_str ());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,36 +53,36 @@ typedef ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> WorldHandler;
|
||||||
/**
|
/**
|
||||||
* WorldSocket.
|
* WorldSocket.
|
||||||
*
|
*
|
||||||
* This class is responsible for the comunication with
|
* This class is responsible for the communication with
|
||||||
* remote clients.
|
* remote clients.
|
||||||
* Most methods return -1 on failure.
|
* Most methods return -1 on failure.
|
||||||
* The class uses refferece counting.
|
* The class uses reference counting.
|
||||||
*
|
*
|
||||||
* For output the class uses one buffer (64K usually) and
|
* For output the class uses one buffer (64K usually) and
|
||||||
* a queue where it stores packet if there is no place on
|
* a queue where it stores packet if there is no place on
|
||||||
* the queue. The reason this is done, is because the server
|
* the queue. The reason this is done, is because the server
|
||||||
* does realy a lot of small-size writes to it, and it doesn't
|
* does really a lot of small-size writes to it, and it doesn't
|
||||||
* scale well to allocate memory for every. When something is
|
* scale well to allocate memory for every. When something is
|
||||||
* writen to the output buffer the socket is not immideately
|
* written to the output buffer the socket is not immediately
|
||||||
* activated for output (again for the same reason), there
|
* activated for output (again for the same reason), there
|
||||||
* is 10ms celling (thats why there is Update() method).
|
* is 10ms celling (thats why there is Update() method).
|
||||||
* This concept is simmilar to TCP_CORK, but TCP_CORK
|
* This concept is similar to TCP_CORK, but TCP_CORK
|
||||||
* usses 200ms celling. As result overhead generated by
|
* uses 200ms celling. As result overhead generated by
|
||||||
* sending packets from "producer" threads is minimal,
|
* sending packets from "producer" threads is minimal,
|
||||||
* and doing a lot of writes with small size is tollerated.
|
* and doing a lot of writes with small size is tolerated.
|
||||||
*
|
*
|
||||||
* The calls to Upate () method are managed by WorldSocketMgr
|
* The calls to Update () method are managed by WorldSocketMgr
|
||||||
* and ReactorRunnable.
|
* and ReactorRunnable.
|
||||||
*
|
*
|
||||||
* For input ,the class uses one 1024 bytes buffer on stack
|
* For input ,the class uses one 1024 bytes buffer on stack
|
||||||
* to which it does recv() calls. And then recieved data is
|
* to which it does recv() calls. And then received data is
|
||||||
* distributed where its needed. 1024 matches pritey well the
|
* distributed where its needed. 1024 matches pretty well the
|
||||||
* traffic generated by client for now.
|
* traffic generated by client for now.
|
||||||
*
|
*
|
||||||
* The input/output do speculative reads/writes (AKA it tryes
|
* The input/output do speculative reads/writes (AKA it tryes
|
||||||
* to read all data avaible in the kernel buffer or tryes to
|
* to read all data available in the kernel buffer or tryes to
|
||||||
* write everything avaible in userspace buffer),
|
* write everything available in userspace buffer),
|
||||||
* which is ok for using with Level and Edge Trigered IO
|
* which is ok for using with Level and Edge Triggered IO
|
||||||
* notification.
|
* notification.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
@ -97,7 +97,7 @@ class WorldSocket : protected WorldHandler
|
||||||
/// Declare the acceptor for this class
|
/// Declare the acceptor for this class
|
||||||
typedef ACE_Acceptor< WorldSocket, ACE_SOCK_ACCEPTOR > Acceptor;
|
typedef ACE_Acceptor< WorldSocket, ACE_SOCK_ACCEPTOR > Acceptor;
|
||||||
|
|
||||||
/// Mutex type used for various syncronizations.
|
/// Mutex type used for various synchronizations.
|
||||||
typedef ACE_Thread_Mutex LockType;
|
typedef ACE_Thread_Mutex LockType;
|
||||||
typedef ACE_Guard<LockType> GuardType;
|
typedef ACE_Guard<LockType> GuardType;
|
||||||
|
|
||||||
|
|
@ -118,10 +118,10 @@ class WorldSocket : protected WorldHandler
|
||||||
/// @return -1 of failure
|
/// @return -1 of failure
|
||||||
int SendPacket (const WorldPacket& pct);
|
int SendPacket (const WorldPacket& pct);
|
||||||
|
|
||||||
/// Add refference to this object.
|
/// Add reference to this object.
|
||||||
long AddReference (void);
|
long AddReference (void);
|
||||||
|
|
||||||
/// Remove refference to this object.
|
/// Remove reference to this object.
|
||||||
long RemoveReference (void);
|
long RemoveReference (void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -183,7 +183,7 @@ class WorldSocket : protected WorldHandler
|
||||||
/// Time in which the last ping was received
|
/// Time in which the last ping was received
|
||||||
ACE_Time_Value m_LastPingTime;
|
ACE_Time_Value m_LastPingTime;
|
||||||
|
|
||||||
/// Keep track of overspeed pings ,to prevent ping flood.
|
/// Keep track of over-speed pings ,to prevent ping flood.
|
||||||
uint32 m_OverSpeedPings;
|
uint32 m_OverSpeedPings;
|
||||||
|
|
||||||
/// Address of the remote peer
|
/// Address of the remote peer
|
||||||
|
|
@ -195,21 +195,21 @@ class WorldSocket : protected WorldHandler
|
||||||
/// Mutex lock to protect m_Session
|
/// Mutex lock to protect m_Session
|
||||||
LockType m_SessionLock;
|
LockType m_SessionLock;
|
||||||
|
|
||||||
/// Session to which recieved packets are routed
|
/// Session to which received packets are routed
|
||||||
WorldSession* m_Session;
|
WorldSession* m_Session;
|
||||||
|
|
||||||
/// here are stored the fragmens of the recieved data
|
/// here are stored the fragments of the received data
|
||||||
WorldPacket* m_RecvWPct;
|
WorldPacket* m_RecvWPct;
|
||||||
|
|
||||||
/// This block actually refers to m_RecvWPct contents,
|
/// This block actually refers to m_RecvWPct contents,
|
||||||
/// which alows easy and safe writing to it.
|
/// which allows easy and safe writing to it.
|
||||||
/// It wont free memory when its deleted. m_RecvWPct takes care of freeing.
|
/// It wont free memory when its deleted. m_RecvWPct takes care of freeing.
|
||||||
ACE_Message_Block m_RecvPct;
|
ACE_Message_Block m_RecvPct;
|
||||||
|
|
||||||
/// Fragment of the recieved header.
|
/// Fragment of the received header.
|
||||||
ACE_Message_Block m_Header;
|
ACE_Message_Block m_Header;
|
||||||
|
|
||||||
/// Mutex for protecting otuput related data.
|
/// Mutex for protecting output related data.
|
||||||
LockType m_OutBufferLock;
|
LockType m_OutBufferLock;
|
||||||
|
|
||||||
/// Buffer used for writing output.
|
/// Buffer used for writing output.
|
||||||
|
|
@ -219,7 +219,7 @@ class WorldSocket : protected WorldHandler
|
||||||
size_t m_OutBufferSize;
|
size_t m_OutBufferSize;
|
||||||
|
|
||||||
/// Here are stored packets for which there was no space on m_OutBuffer,
|
/// Here are stored packets for which there was no space on m_OutBuffer,
|
||||||
/// this alows not-to kick player if its buffer is overflowed.
|
/// this allows not-to kick player if its buffer is overflowed.
|
||||||
PacketQueueT m_PacketQueue;
|
PacketQueueT m_PacketQueue;
|
||||||
|
|
||||||
/// True if the socket is registered with the reactor for output
|
/// True if the socket is registered with the reactor for output
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue