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

Method Disconnect

src/engine/shared/network_conn.cpp:276–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274}
275
276void CNetConnection::Disconnect(const char *pReason)
277{
278 if(State() == EState::OFFLINE)
279 return;
280
281 if(m_RemoteClosed == 0)
282 {
283 if(!m_TimeoutSituation)
284 {
285 if(pReason)
286 SendControl(NET_CTRLMSG_CLOSE, pReason, str_length(pReason) + 1);
287 else
288 SendControl(NET_CTRLMSG_CLOSE, nullptr, 0);
289 }
290
291 if(pReason != m_aErrorString)
292 {
293 m_aErrorString[0] = 0;
294 if(pReason)
295 str_copy(m_aErrorString, pReason);
296 }
297 }
298
299 Reset();
300}
301
302void CNetConnection::DirectInit(const NETADDR &Addr, SECURITY_TOKEN SecurityToken, SECURITY_TOKEN Token, bool Sixup)
303{

Callers 3

CloseMethod · 0.45
DropMethod · 0.45
DropMethod · 0.45

Calls 2

str_lengthFunction · 0.85
str_copyFunction · 0.50

Tested by

no test coverage detected