From: Matthias Kruk Date: Sun, 2 Oct 2022 05:53:59 +0000 (+0900) Subject: utils/ipc-inject: Don't inject messages with header X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=de8e07924f98918186a750bedcfaa8ff25207146;p=toolbox utils/ipc-inject: Don't inject messages with header 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. --- diff --git a/utils/ipc-inject.sh b/utils/ipc-inject.sh index bb0000a..df3c9ba 100755 --- a/utils/ipc-inject.sh +++ b/utils/ipc-inject.sh @@ -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