Skip to content

Commit

Permalink
Reset parser on message size command
Browse files Browse the repository at this point in the history
  • Loading branch information
vinceau committed Nov 11, 2020
1 parent aaced99 commit 95302be
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/stream/rxSlpStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,18 @@ export class RxSlpStream extends SlpFileWriter {

this.on(SlpStreamEvent.COMMAND, (data: SlpCommandEventPayload) => {
const { command, payload } = data;
try {
this.parser.handleCommand(command, payload);
} catch (err) {
console.error(`Error processing command ${command}: ${err}`);
}

switch (command) {
case Command.MESSAGE_SIZES:
this.parser.reset();
this.messageSizeSource.next(payload as MessageSizes);
break;
}

try {
this.parser.handleCommand(command, payload);
} catch (err) {
console.error(`Error processing command ${command}: ${err}`);
}
});
}

Expand Down

0 comments on commit 95302be

Please sign in to comment.