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

Method FreeId

src/engine/server/snap_id_pool.cpp:74–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74void CSnapIdPool::FreeId(int Id)
75{
76 if(Id < 0)
77 return;
78 dbg_assert((size_t)Id < std::size(m_aIds), "id is out of range");
79 dbg_assert(m_aIds[Id].m_State == ID_ALLOCATED, "id is not allocated");
80
81 m_InUsage--;
82 m_aIds[Id].m_State = ID_TIMED;
83 m_aIds[Id].m_Timeout = time_get() + time_freq() * 5;
84 m_aIds[Id].m_Next = -1;
85
86 if(m_LastTimed != -1)
87 {
88 m_aIds[m_LastTimed].m_Next = Id;
89 m_LastTimed = Id;
90 }
91 else
92 {
93 m_FirstTimed = Id;
94 m_LastTimed = Id;
95 }
96}

Callers 1

SnapFreeIdMethod · 0.80

Calls 2

time_getFunction · 0.85
time_freqFunction · 0.85

Tested by

no test coverage detected