From beda047eb01384ec4f533f67fa5b9769e912bc03 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Mon, 6 Feb 2023 02:29:00 +0000 Subject: [PATCH] Disable Nagle's algorithm before we start the TLS handshake. Just speculation that it will help with some responsiveness. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4170 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- core/httpd.js | 13 ++++++++----- src/ssb.rpc.c | 1 - 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/core/httpd.js b/core/httpd.js index cf557a4f..b5836cb0 100644 --- a/core/httpd.js +++ b/core/httpd.js @@ -456,8 +456,6 @@ function handleConnection(client) { } } - client.noDelay = true; - client.onError(function(error) { logError(client.peerName + " - - [" + new Date() + "] " + error); }); @@ -558,10 +556,14 @@ let kHost = "0.0.0.0" let socket = new Socket(); socket.bind(kHost, tildefriends.http_port).then(function() { - let listenResult = socket.listen(kBacklog, function() { - socket.accept().then(handleConnection).catch(function(error) { + let listenResult = socket.listen(kBacklog, async function() { + try { + let client = await socket.accept(); + client.noDelay = true; + handleConnection(client); + } catch (error) { logError("[" + new Date() + "] accept error " + error); - }); + } }); }).catch(function(error) { logError("[" + new Date() + "] bind error " + error); @@ -574,6 +576,7 @@ if (tildefriends.https_port) { return secureSocket.listen(kBacklog, async function() { try { let client = await secureSocket.accept(); + client.noDelay = true; client.tls = true; const kCertificatePath = "data/httpd/certificate.pem"; const kPrivateKeyPath = "data/httpd/privatekey.pem"; diff --git a/src/ssb.rpc.c b/src/ssb.rpc.c index 81c66f0f..7027ba0c 100644 --- a/src/ssb.rpc.c +++ b/src/ssb.rpc.c @@ -863,7 +863,6 @@ static void _tf_ssb_rpc_ebt_replicate_send_clock(tf_ssb_connection_t* connection tf_free(visible); - /* TODO: Send it in bite-size chunks. */ tf_ssb_connection_rpc_send_json(connection, k_ssb_rpc_flag_stream, -request_number, full_clock, NULL, NULL, NULL); JS_FreeValue(context, full_clock); }