mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2026-03-14 23:09:45 +01:00
unetmsg: add timeout for outgoing auth requests
Add a 10-second timeout for outgoing auth requests to prevent
connections from getting stuck when the remote peer goes silent
after the hello handshake but before responding to auth.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry picked from commit 8a304d051f)
This commit is contained in:
parent
e1728da72f
commit
7b68399ecf
1 changed files with 5 additions and 0 deletions
|
|
@ -307,6 +307,8 @@ function network_open_channel(net, name, peer)
|
|||
if (!network_auth_valid(sock_data.name, sock_data.id, msg.token))
|
||||
return;
|
||||
|
||||
if (sock_data.timer)
|
||||
sock_data.timer.cancel();
|
||||
sock_data.auth = true;
|
||||
core.dbg(`Outgoing connection to ${name} established\n`);
|
||||
|
||||
|
|
@ -344,6 +346,9 @@ function network_open_channel(net, name, peer)
|
|||
data_cb: auth_data_cb,
|
||||
cb: auth_cb,
|
||||
});
|
||||
sock_data.timer = uloop.timer(10 * 1000, () => {
|
||||
network_tx_socket_close(sock_data);
|
||||
});
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue