]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
unetmsg: notify subscribers when remote peer connection drops
authorJohn Crispin <john@phrozen.org>
Fri, 6 Feb 2026 07:41:49 +0000 (08:41 +0100)
committerFelix Fietkau <nbd@nbd.name>
Sat, 7 Feb 2026 09:04:18 +0000 (10:04 +0100)
When a remote peer's connection drops (device powered off, unetmsgd
crash, network failure), network_rx_cleanup_state silently removed
the remote publish/subscribe handles without notifying local
subscribers. This meant local clients had no way to detect that a
remote peer had disappeared.

Call handle_publish for each channel where a remote publish handle
is removed during connection cleanup, so local subscribers receive
the publisher change notification and can react accordingly.

Signed-off-by: John Crispin <john@phrozen.org>
package/network/services/unetmsg/files/usr/share/ucode/unetmsg/unetmsgd-remote.uc

index e5f1b7fb5f9d3e7c80ae5578f4e15a542ce7dcf6..a02ba08c671a18c8914b4db279336ae114769f41 100644 (file)
@@ -51,8 +51,12 @@ function network_rx_cleanup_state(name)
        for (let cur, sub in core.remote_subscribe)
                delete sub[name];
 
-       for (let cur, sub in core.remote_publish)
+       for (let cur, sub in core.remote_publish) {
+               if (!sub[name])
+                       continue;
                delete sub[name];
+               core.handle_publish(null, cur);
+       }
 }
 
 function network_rx_socket_close(data)