Don't crash on unknown command
This commit is contained in:
+3
-1
@@ -15,8 +15,10 @@ export default async function idz(socket: Socket) {
|
||||
output.write(await dispatch(world, req));
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("Idz: Error", e);
|
||||
console.log("Idz: Error:", e);
|
||||
}
|
||||
|
||||
console.log("Idz: Connection closed\n");
|
||||
|
||||
input.end();
|
||||
}
|
||||
|
||||
+7
-3
@@ -35,12 +35,16 @@ console.log("RSA ENCDEC :", byteString(test2, 0x40).toString("hex"));
|
||||
// -- TEST --
|
||||
|
||||
interface Session {
|
||||
input: AsyncIterable<Request>;
|
||||
input: AsyncIterable<Request> & {
|
||||
end: () => void;
|
||||
};
|
||||
output: {
|
||||
write: (res: Response) => void;
|
||||
};
|
||||
}
|
||||
|
||||
function doNothing() {}
|
||||
|
||||
export function setup(socket: Socket): Session {
|
||||
//
|
||||
// Construct and transmit setup message
|
||||
@@ -67,13 +71,13 @@ export function setup(socket: Socket): Session {
|
||||
socket,
|
||||
createDecipheriv("aes-128-ecb", keybuf, null).setAutoPadding(false),
|
||||
input
|
||||
);
|
||||
).catch(doNothing);
|
||||
|
||||
pipeline(
|
||||
output,
|
||||
createCipheriv("aes-128-ecb", keybuf, null).setAutoPadding(false),
|
||||
socket
|
||||
);
|
||||
).catch(doNothing);
|
||||
|
||||
return { input, output };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user