]> git.corax.cc Git - toolbox/commitdiff
utils/ipc-inject: Don't inject messages with header
authorMatthias Kruk <m@m10k.eu>
Sun, 2 Oct 2022 05:53:59 +0000 (14:53 +0900)
committerMatthias Kruk <m@m10k.eu>
Sun, 2 Oct 2022 05:53:59 +0000 (14:53 +0900)
When ipc-inject injects a message, it uses ipc_endpoint_publish()
to re-publish it in its entirety, including the wrapper it was
received in, causing it to be double-wrapped.

This commit modifies ipc-inject so that it re-publishes only the
data of the received message, instead of the entire message.

utils/ipc-inject.sh

index bb0000a1b2e5d45171eed9e3e4d0734950af4e46..df3c9baedea8a1bc5f8f8bf1f4d106672aaf0bd4 100755 (executable)
@@ -68,15 +68,21 @@ handle_hook_data() {
 
 handle_ipc_message() {
        local endpoint="$1"
-       local data="$2"
+       local message="$2"
 
        local topic
+       local data
 
-       if ! topic=$(ipc_msg_get_topic "$data"); then
+       if ! topic=$(ipc_msg_get_topic "$message"); then
                log_warn "Dropping message without topic"
                return 1
        fi
 
+       if ! data=$(ipc_msg_get_data "$message"); then
+               log_warn "Dropping message without data"
+               return 1
+       fi
+
        if ! ipc_endpoint_publish "$endpoint" "$topic" "$data"; then
                log_error "Could not publish message for $topic on $endpoint"
                return 1