Socket leak on accept.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4144 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-01-21 20:12:41 +00:00
parent adefa76dfd
commit 5d5ff121f9
2 changed files with 5 additions and 7 deletions

View File

@ -180,13 +180,10 @@ function handleRequest(request, response) {
if (handler) { if (handler) {
try { try {
let promise = handler.invoke(request, response); Promise.resolve(handler.invoke(request, response)).catch(function(error) {
if (promise) { response.reportError(error);
promise.catch(function(error) { request.client.close();
response.reportError(error); });
request.client.close();
});
}
} catch (error) { } catch (error) {
response.reportError(error); response.reportError(error);
request.client.close(); request.client.close();

View File

@ -605,6 +605,7 @@ JSValue _socket_accept(JSContext* context, JSValueConst this_val, int argc, JSVa
} }
client->_connected = true; client->_connected = true;
tf_task_resolve_promise(socket->_task, promise, client->_object); tf_task_resolve_promise(socket->_task, promise, client->_object);
JS_FreeValue(context, client->_object);
} }
else else
{ {