[openwrt/openwrt] unetmsg: notify subscribers when remote peer connection drops

LEDE Commits lede-commits at lists.infradead.org
Mon Feb 16 00:21:02 PST 2026


nbd pushed a commit to openwrt/openwrt.git, branch openwrt-25.12:
https://git.openwrt.org/3091dbcb45bd9c783db17c58f7b822ebf6a8c3a1

commit 3091dbcb45bd9c783db17c58f7b822ebf6a8c3a1
Author: John Crispin <john at phrozen.org>
AuthorDate: Fri Feb 6 08:41:49 2026 +0100

    unetmsg: notify subscribers when remote peer connection drops
    
    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 at phrozen.org>
    (cherry picked from commit 7fd71f2c7424c75f6aca26f523e084012b122714)
---
 .../unetmsg/files/usr/share/ucode/unetmsg/unetmsgd-remote.uc        | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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 e5f1b7fb5f..a02ba08c67 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
@@ -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)




More information about the lede-commits mailing list