Fix reference issue with packet parsers

This commit is contained in:
Bill 2022-03-02 18:59:59 -05:00
parent dce98c249f
commit 43cc4d7222
2 changed files with 4 additions and 8 deletions

View File

@ -301,9 +301,12 @@ export class SocketConnection extends EventDispatcher implements IConnection
try try
{ {
const parser = events[0].parser; //@ts-ignore
const parser = new events[0].parserClass();
if(!parser || !parser.flush() || !parser.parse(wrapper)) return null; if(!parser || !parser.flush() || !parser.parse(wrapper)) return null;
for(const event of events) (event.parser = parser);
} }
catch (e) catch (e)

View File

@ -67,13 +67,6 @@ export class MessageClassManager
existing = []; existing = [];
this._messageInstancesById.set(header, existing); this._messageInstancesById.set(header, existing);
//@ts-ignore
event.parser = new event.parserClass();
}
else
{
event.parser = existing[0].parser;
} }
existing.push(event); existing.push(event);