From 429881072860a362e2632bd32d241739706b436d Mon Sep 17 00:00:00 2001 From: Tau Date: Fri, 12 Jul 2019 14:13:51 -0400 Subject: [PATCH] aimedb: Defensively close connection after a Goodbye We should probably also add request timeouts and such. --- src/aimedb/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/aimedb/index.ts b/src/aimedb/index.ts index 8aa6c5c..8243834 100644 --- a/src/aimedb/index.ts +++ b/src/aimedb/index.ts @@ -19,9 +19,13 @@ export default async function aimedb(socket: Socket) { const req = obj as AimeRequest; const res = await dispatch(txn, req, now); - if (res !== undefined) { - output.write(res); + if (res === undefined) { + console.log("Aimedb: Closing connection"); + + break; } + + output.write(res); } await txn.commit();