@@ -91,13 +91,13 @@ template <typename SessionType, typename SocketName, typename Crypt>
9191class MangosSocket : public WorldHandler
9292{
9393 public:
94- // things called by ACE framework.
94+ // Things called by ACE framework.
9595 MangosSocket ();
9696 virtual ~MangosSocket (void );
9797
98- // Declare the acceptor for this class
98+ // Declare the acceptor for this class.
9999 typedef ACE_Connector<SocketName,ACE_SOCK_CONNECTOR> Connector;
100- // Declare some friends
100+ // Declare some friends.
101101 friend class ACE_Connector <SocketName, ACE_SOCK_CONNECTOR>;
102102 friend class ACE_NonBlocking_Connect_Handler <SocketName>;
103103
@@ -121,7 +121,7 @@ class MangosSocket : public WorldHandler
121121 virtual int close (int );
122122
123123 // Get address of connected peer.
124- const std::string& GetRemoteAddress () const { return m_Address ; }
124+ const std::string& GetRemoteAddress () const { return m_address ; }
125125
126126 // Send A packet on the socket, this function is reentrant.
127127 // @param pct packet to send
@@ -134,16 +134,16 @@ class MangosSocket : public WorldHandler
134134 // Remove reference to this object.
135135 long RemoveReference () { return static_cast <long >(remove_reference ()); }
136136
137- void SetSession (SessionType* t) { m_Session = t; }
138- void SetClientSocket () { m_isServerSocket = false ; }
139- /* *
140- * @brief returns true iif the socket is connected TO a client (ie we are the server)
141- */
137+ // Linking the socket to its world session.
138+ void SetSession (SessionType* t) { m_session = t; }
139+
140+ // Returns true if the socket is connected TO a client (ie we are the server).
142141 bool IsServerSide () { return m_isServerSocket; }
142+ void SetClientSocket () { m_isServerSocket = false ; }
143+
143144 protected:
144- // process one incoming packet.
145- // @param new_pct received packet ,note that you need to delete it.
146- int ProcessIncoming (WorldPacket* new_pct) { delete new_pct; return 0 ; }
145+ // Process one incoming packet, note that you need to delete it.
146+ int ProcessIncoming (WorldPacket* newPct) { delete newPct; return 0 ; }
147147 int OnSocketOpen () { return 0 ; }
148148
149149 // Called when we can read from the socket.
@@ -165,67 +165,69 @@ class MangosSocket : public WorldHandler
165165 int handle_input_missing_data (void );
166166
167167 // Help functions to mark/unmark the socket for output.
168- // @param g the guard is for m_OutBufferLock , the function will release it
168+ // @param g the guard is for m_outBufferLock , the function will release it
169169 int cancel_wakeup_output (GuardType& g);
170170 int schedule_wakeup_output (GuardType& g);
171171
172- // Try to write WorldPacket to m_OutBuffer ,return -1 if no space
173- // Need to be called with m_OutBufferLock lock held
174- int iSendPacket (const WorldPacket& pct);
172+ // Try to write WorldPacket to m_outBuffer ,return -1 if no space
173+ // Need to be called with m_outBufferLock lock held
174+ int iSendPacket (WorldPacket const & pct);
175175
176- // Flush m_PacketQueue if there are packets in it
177- // Need to be called with m_OutBufferLock lock held
176+ // Flush m_packetQueue if there are packets in it
177+ // Need to be called with m_outBufferLock lock held
178178 // @return true if it wrote to the buffer ( AKA you need
179179 // to mark the socket for output ).
180180 bool iFlushPacketQueue ();
181181
182182 // Time in which the last ping was received
183- ACE_Time_Value m_LastPingTime ;
183+ ACE_Time_Value m_lastPingTime ;
184184
185185 // Keep track of over-speed pings ,to prevent ping flood.
186- uint32 m_OverSpeedPings ;
186+ uint32 m_overSpeedPings ;
187187
188188 // Address of the remote peer
189- std::string m_Address ;
189+ std::string m_address ;
190190
191- // Class used for managing encryption of the headers
192- Crypt m_Crypt ;
191+ // Class used for managing encryption of the headers.
192+ Crypt m_crypt ;
193193
194- // Mutex lock to protect m_Session
195- LockType m_SessionLock ;
194+ // Mutex lock to protect m_session.
195+ LockType m_sessionLock ;
196196
197- // Session to which received packets are routed
198- SessionType* m_Session ;
197+ // Session to which received packets are routed.
198+ SessionType* m_session ;
199199
200- // here are stored the fragments of the received data
201- WorldPacket* m_RecvWPct ;
200+ // here are stored the fragments of the received data.
201+ WorldPacket* m_recvWPct ;
202202
203- // This block actually refers to m_RecvWPct contents,
203+ // This block actually refers to m_recvWPct contents,
204204 // which allows easy and safe writing to it.
205- // It wont free memory when its deleted. m_RecvWPct takes care of freeing.
206- ACE_Message_Block m_RecvPct ;
205+ // It wont free memory when its deleted. m_recvWPct takes care of freeing.
206+ ACE_Message_Block m_recvPct ;
207207
208208 // Fragment of the received header.
209- ACE_Message_Block m_Header ;
209+ ACE_Message_Block m_header ;
210210
211211 // Mutex for protecting output related data.
212- LockType m_OutBufferLock ;
212+ LockType m_outBufferLock ;
213213
214214 // Buffer used for writing output.
215- ACE_Message_Block *m_OutBuffer ;
215+ ACE_Message_Block* m_outBuffer ;
216216
217- // Size of the m_OutBuffer .
218- size_t m_OutBufferSize ;
217+ // Size of the m_outBuffer .
218+ size_t m_outBufferSize ;
219219
220- // Here are stored packets for which there was no space on m_OutBuffer ,
220+ // Here are stored packets for which there was no space on m_outBuffer ,
221221 // this allows not-to kick player if its buffer is overflowed.
222- PacketQueueT m_PacketQueue ;
222+ PacketQueueT m_packetQueue ;
223223
224- // True if the socket is registered with the reactor for output
225- bool m_OutActive ;
224+ // True if the socket is registered with the reactor for output.
225+ bool m_outActive ;
226226
227- uint32 m_Seed;
227+ // Sent to client in SMSG_AUTH_CHALLENGE.
228+ uint32 m_seed;
228229
230+ // Connecting to other server is also possible (potential clustering).
229231 bool m_isServerSocket;
230232};
231233
0 commit comments