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

Method ResumeConnection

src/engine/shared/network_conn.cpp:590–618  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

588}
589
590void CNetConnection::ResumeConnection(const NETADDR *pAddr, int Sequence, int Ack, SECURITY_TOKEN SecurityToken, CStaticRingBuffer<CNetChunkResend, NET_CONN_BUFFERSIZE> *pResendBuffer, bool Sixup)
591{
592 int64_t Now = time_get();
593
594 m_Sequence = Sequence;
595 m_Ack = Ack;
596 m_RemoteClosed = 0;
597
598 m_State = EState::ONLINE;
599 SetPeerAddr(pAddr);
600 m_aErrorString[0] = '\0';
601 m_LastSendTime = Now;
602 m_LastRecvTime = Now;
603 m_LastUpdateTime = Now;
604 m_SecurityToken = SecurityToken;
605 m_Sixup = Sixup;
606
607 // copy resend buffer
608 m_Buffer.Init();
609 while(pResendBuffer->First())
610 {
611 CNetChunkResend *pFirst = pResendBuffer->First();
612
613 CNetChunkResend *pResend = m_Buffer.Allocate(sizeof(CNetChunkResend) + pFirst->m_DataSize);
614 mem_copy(pResend, pFirst, sizeof(CNetChunkResend) + pFirst->m_DataSize);
615
616 pResendBuffer->PopFirst();
617 }
618}

Callers 1

ResumeOldConnectionMethod · 0.80

Calls 6

time_getFunction · 0.85
mem_copyFunction · 0.85
InitMethod · 0.45
FirstMethod · 0.45
AllocateMethod · 0.45
PopFirstMethod · 0.45

Tested by

no test coverage detected