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

Method Read

src/Wisp/WispPacketReader.cpp:20–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18}
19
20void CPacketReader::Read(CConnection *connection)
21{
22 if (connection->ReadyRead())
23 {
24 if (!connection->Read())
25 {
26 OnReadFailed();
27 return;
28 }
29
30 Wisp::CPacketMessage *parser = connection->m_MessageParser;
31
32 while (true)
33 {
34 int offset = 0;
35 std::vector<uint8_t> packet = parser->Read(this, offset);
36
37 if (packet.empty())
38 {
39 break;
40 }
41
42 if (MaxPacketStackSize != 0)
43 {
44 m_PacketsStack.push_back(packet);
45
46 if ((int)m_PacketsStack.size() > MaxPacketStackSize)
47 {
48 m_PacketsStack.pop_front();
49 }
50 }
51
52 SetData((uint8_t *)&packet[0], packet.size(), offset);
53 OnPacket();
54 }
55 }
56}
57
58}; // namespace Wisp

Callers

nothing calls this directly

Calls 5

ReadyReadMethod · 0.80
pop_frontMethod · 0.80
emptyMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected