MCPcopy Create free account
hub / github.com/OneLoneCoder/olcPixelGameEngine / Update

Method Update

extensions/olcPGEX_Network.h:969–986  ·  view source on GitHub ↗

Force server to respond to incoming messages

Source from the content-addressed store, hash-verified

967
968 // Force server to respond to incoming messages
969 void Update(size_t nMaxMessages = -1, bool bWait = false)
970 {
971 if (bWait) m_qMessagesIn.wait();
972
973 // Process as many messages as you can up to the value
974 // specified
975 size_t nMessageCount = 0;
976 while (nMessageCount < nMaxMessages && !m_qMessagesIn.empty())
977 {
978 // Grab the front message
979 auto msg = m_qMessagesIn.pop_front();
980
981 // Pass to message handler
982 OnMessage(msg.remote, msg.msg);
983
984 nMessageCount++;
985 }
986 }
987
988 protected:
989 // This server class should override thse functions to implement

Callers

nothing calls this directly

Calls 3

waitMethod · 0.80
emptyMethod · 0.80
pop_frontMethod · 0.80

Tested by

no test coverage detected