MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / NetClient

Method NetClient

engine/Poseidon/Network/NetTransportNet.cpp:806–836  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

804 if (_enum->_sessions[i].ip == ip && _enum->_sessions[i].port == port)
805 {
806 iFound = i;
807 break;
808 }
809 }
810
811 unsigned64 reqTime = msg->getChannel()->getMessageTime(s->request);
812 // actual ping time in milliseconds:
813 unsigned pingTime = reqTime ? (unsigned)((msg->getTime() - reqTime) / 1000) : 0;
814
815 if (iFound < 0)
816 { // not found
817 iFound = _enum->_sessions.Add();
818 if (iFound < 0)
819 { // too much sessions encountered
820 _enum->leave();
821 return nsNoMoreCallbacks;
822 }
823 NetSessionDescription& ndesc = _enum->_sessions[iFound];
824 ndesc.ip = ip;
825 ndesc.port = port;
826 ndesc.pingTime = pingTime;
827 snprintf(ndesc.address, sizeof(ndesc.address), "%s:%u", inet_ntoa(distant.sin_addr),
828 (unsigned)port);
829 }
830
831 NetSessionDescription& desc = _enum->_sessions[iFound];
832 // s->name is the remote server's wire-supplied name; it must be copied as
833 // data, never used as the printf format, so conversion specifiers in the
834 // name are shown literally rather than interpreted.
835 snprintf(desc.name, sizeof(desc.name), "%s", s->name);
836 desc.actualVersion = s->actualVersion;
837 desc.requiredVersion = s->requiredVersion;
838 strncpy(desc.mission, s->mission, LEN_MISSION_NAME);
839 desc.mission[LEN_MISSION_NAME - 1] = (char)0;

Callers

nothing calls this directly

Calls 4

getSystemTimeFunction · 0.85
setClientFunction · 0.85
getClientPeerFunction · 0.85
getPeerIdMethod · 0.80

Tested by

no test coverage detected