From 80eb54ee1363da845c820a8b1132e2d0f7a41c1b Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 21 Nov 2022 14:34:49 -0500 Subject: [PATCH] LP2017941 HTTP translator works w/ routed redis Signed-off-by: Bill Erickson --- src/gateway/osrf_http_translator.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gateway/osrf_http_translator.c b/src/gateway/osrf_http_translator.c index ec8a685..a0d2e36 100644 --- a/src/gateway/osrf_http_translator.c +++ b/src/gateway/osrf_http_translator.c @@ -199,8 +199,7 @@ static int osrfHttpTranslatorSetTo(osrfHttpTranslator* trans) { } else { // service is specified, build a recipient address // from the router, domain, and service - int size = snprintf(recipientBuf, 128, "%s@%s/%s", routerName, - domainName, trans->service); + int size = snprintf(recipientBuf, 128, "opensrf:service:%s", trans->service); recipientBuf[size] = '\0'; osrfLogDebug(OSRF_LOG_MARK, "Set recipient to %s", recipientBuf); trans->recipient = recipientBuf; @@ -424,7 +423,16 @@ static int osrfHttpTranslatorProcess(osrfHttpTranslator* trans) { transport_message* tmsg = message_init( jsonBody, NULL, trans->thread, trans->recipient, NULL); message_set_osrf_xid(tmsg, osrfLogGetXid()); - client_send_message(trans->handle, tmsg); + + // Message destined for a service + char* send_to = trans->recipient; + if (strstr(send_to, "opensrf:service:")) { + char stbuf[1024 + 1]; + snprintf(stbuf, 1024, "opensrf:router:%s", domainName); + send_to = stbuf; + } + + client_send_message_to(trans->handle, tmsg, send_to); message_free(tmsg); free(jsonBody); -- 2.11.0