[openwrt/openwrt] unetmsg: make remote connection TCP timeout more aggressive

LEDE Commits lede-commits at lists.infradead.org
Sat Jun 21 08:13:09 PDT 2025


nbd pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/91a50b27bc78ab77dbce898791afa08b98ebe1f3

commit 91a50b27bc78ab77dbce898791afa08b98ebe1f3
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Sat Jun 21 17:12:05 2025 +0200

    unetmsg: make remote connection TCP timeout more aggressive
    
    It is meant for reliable network connections, so requests should fail
    early if a node goes down.
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 .../unetmsg/files/usr/share/ucode/unetmsg/unetmsgd-remote.uc         | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd-remote.uc b/package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd-remote.uc
index b6bf33b399..5dda32c13c 100644
--- a/package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd-remote.uc
+++ b/package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd-remote.uc
@@ -15,6 +15,7 @@ let ev_listener, sub;
 let networks = {};
 
 const USYNC_PORT = 51818;
+const TCP_TIMEOUT = 5 * 1000;
 
 const pubsub_proto = {
 	get_channel: function() {
@@ -300,7 +301,7 @@ function network_open_channel(net, name, peer)
 		return;
 
 	core.dbg(`Try to connect to ${name}\n`);
-	sock.setopt(socket.SOL_TCP, socket.TCP_USER_TIMEOUT, 30 * 1000);
+	sock.setopt(socket.SOL_TCP, socket.TCP_USER_TIMEOUT, TCP_TIMEOUT);
 	sock.connect(addr);
 	let auth_data_cb = (msg) => {
 		if (!network_auth_valid(sock_data.name, sock_data.id, msg.token))
@@ -409,7 +410,7 @@ function network_open(name, info)
 	net.rx_channels = {};
 	net.tx_channels = {};
 
-	net.socket.setopt(socket.SOL_TCP, socket.TCP_USER_TIMEOUT, 30 * 1000);
+	net.socket.setopt(socket.SOL_TCP, socket.TCP_USER_TIMEOUT, TCP_TIMEOUT);
 
 	let cb = () => {
 		let addr = {};




More information about the lede-commits mailing list