Skip to content

Commit b1d67e0

Browse files
authored
Merge pull request #254 from spacevx/recv-tables-disconnect-fix
Free recv tables on client disconnect
2 parents 59267dc + 39b6c41 commit b1d67e0

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

‎Source.Engine/Client/BaseClientState.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public virtual void Clear() {
169169

170170
FreeEntityBaselines();
171171

172-
// ?? review RecvTable.Term(false);
172+
engineRecvTable.Term(false);
173173

174174
NetChannel?.Reset();
175175

‎Source.Engine/EngineRecvTable.cs‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,23 @@ bool NewTable(RecvTable table) {
306306

307307
return true;
308308
}
309+
310+
public void Term(bool clearAll = true) {
311+
foreach (RecvTable table in DtCommonEng.RecvTables) {
312+
if (!table.IsInMainList())
313+
continue;
314+
315+
table.SetInMainList(false);
316+
table.Decoder = null;
317+
}
318+
319+
if (clearAll)
320+
DtCommonEng.RecvTables.Clear();
321+
322+
DtCommonEng.RecvDecoders.Clear();
323+
DtCommonEng.ClientSendTables.Clear();
324+
}
325+
309326
public bool Init(Span<RecvTable> tables) {
310327
foreach (var table in tables) {
311328
NewTable(table);

0 commit comments

Comments
 (0)