Trying to fix socket lifetime issues.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3886 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-06-02 10:58:22 +00:00
parent 58f459fb3b
commit 5622db92a7
3 changed files with 105 additions and 80 deletions

View File

@ -175,10 +175,12 @@ function handleRequest(request, response) {
if (promise) {
promise.catch(function(error) {
response.reportError(error);
request.client.close();
});
}
} catch (error) {
response.reportError(error);
request.client.close();
}
} else {
response.writeHead(200, {"Content-Type": "text/plain; charset=utf-8"});
@ -412,6 +414,7 @@ function handleConnection(client) {
}
} catch (error) {
response.reportError(error);
client.close();
}
}
@ -561,8 +564,9 @@ if (tildefriends.https_port) {
tls.keyStat = stat[1];
}
let result = client.startTls(tls.context);
handleConnection(client);
return client.startTls(tls.context);
return result;
} catch (error) {
logError("[" + new Date() + "] [" + client.peerName + "] " + error);
}