MCPcopy Create free account
hub / github.com/crossuo/crossuo / Recv

Method Recv

src/Managers/ConnectionManager.cpp:220–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218}
219
220void CConnectionManager::Recv()
221{
222 if (m_IsLoginSocket)
223 {
224 if (!m_LoginSocket.Connected)
225 {
226 return;
227 }
228
229 if (!m_LoginSocket.ReadyRead())
230 {
231 if (m_LoginSocket.DataReady == -1)
232 {
233 Info(Network, "Failed to Recv()...Disconnecting...");
234 g_Game.InitScreen(GS_MAIN_CONNECT);
235 g_ConnectionScreen.SetType(CST_CONLOST);
236 }
237 return;
238 }
239
240 g_PacketManager.Read(&m_LoginSocket);
241 }
242 else
243 {
244 if (!m_GameSocket.Connected)
245 {
246 return;
247 }
248
249 if (!m_GameSocket.ReadyRead())
250 {
251 if (m_GameSocket.DataReady == -1)
252 {
253 Info(Network, "Failed to Recv()...Disconnecting...");
254 if (g_GameState == GS_GAME ||
255 (g_GameState == GS_GAME_BLOCKED && (g_GameBlockedScreen.Code != 0u)))
256 {
257 g_Game.DisconnectGump();
258 }
259 else
260 {
261 g_Game.InitScreen(GS_MAIN_CONNECT);
262 g_ConnectionScreen.SetType(CST_CONLOST);
263 }
264 }
265
266 return;
267 }
268
269 g_PacketManager.Read(&m_GameSocket);
270 }
271}
272
273int CConnectionManager::Send(uint8_t *buf, int size)
274{

Callers 1

OnMainLoopMethod · 0.45

Calls 5

ReadyReadMethod · 0.80
InitScreenMethod · 0.80
SetTypeMethod · 0.80
DisconnectGumpMethod · 0.80
ReadMethod · 0.45

Tested by

no test coverage detected