Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion lib/telnet.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ function parseCommand (bufs, i, event) {
var command = bufs.get(i)
event.commandCode = command
event.command = COMMAND_NAMES[command]
if (event.command === undefined) {
throw "Unsupported command received: " + command;
}
return COMMAND_IMPLS[command](bufs, i + 1, event)
}

Expand Down Expand Up @@ -198,7 +201,15 @@ function Socket (input, output) {
var data = bufs.splice(0, i).toBuffer()
self.emit('data', data)
}
i = parse(bufs)
try {
i = parse(bufs);
} catch (e) {
console.log(e);
break; // somehow handle the error. break hangs the entire server; I'm
// guessing that the ctr+c is still in the buffer, and needs to
// be removed. Very new to node, however, so perhaps someone else
// will know how to do that.
}
if (i === MORE) {
debug('need to wait for more...')
break
Expand Down