MCPcopy Create free account
hub / github.com/ddnet/ddnet / Update

Method Update

src/engine/shared/network_stun.cpp:64–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64void CStun::CProtocol::Update()
65{
66 int64_t Now = time_get();
67 if(m_NextTry == -1 || Now < m_NextTry || !m_HaveStunServer)
68 {
69 return;
70 }
71 m_NextTry = Now + RetryWaitSeconds(m_NumUnsuccessfulTries) * time_freq();
72 m_NumUnsuccessfulTries += 1;
73 unsigned char aBuf[32];
74 int Size = StunMessagePrepare(aBuf, sizeof(aBuf), &m_Stun);
75 if(net_udp_send(m_Socket, &m_StunServer, aBuf, Size) == -1)
76 {
77 log_debug(IndexToSystem(m_Index), "couldn't send stun request");
78 return;
79 }
80}
81
82bool CStun::CProtocol::OnPacket(NETADDR Addr, unsigned char *pData, int DataSize)
83{

Callers

nothing calls this directly

Calls 6

time_getFunction · 0.85
RetryWaitSecondsFunction · 0.85
time_freqFunction · 0.85
StunMessagePrepareFunction · 0.85
net_udp_sendFunction · 0.85
IndexToSystemFunction · 0.85

Tested by

no test coverage detected