Fix multi-domain routing issues w/ router reg
authorBill Erickson <berickxx@gmail.com>
Thu, 16 Feb 2023 17:13:20 +0000 (12:13 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 20 Apr 2023 14:18:05 +0000 (10:18 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
src/libopensrf/transport_client.c
src/perl/lib/OpenSRF/Transport/Redis/Client.pm

index a8499ca..435f1aa 100644 (file)
@@ -53,7 +53,7 @@ static transport_con* get_transport_con(transport_client* client, const char* do
     transport_con_set_address(con, NULL);
 
     // Connections to remote domains assume the same connection
-    // attributes apply.
+    // attributes apply, minus the domain.
     transport_con_connect(con, client->port, client->username, client->password);
 
     return con;
@@ -154,7 +154,7 @@ int client_send_message_to(transport_client* client, transport_message* msg, con
 
     transport_con* con;
 
-    if (strstr(receiver, "opensrf:client")) {
+    if (strstr(receiver, "opensrf:client") || strstr(receiver, "opensrf:router")) {
         // We may be talking to a worker that runs on a remote domain.
         // Find or create a connection to the domain.
 
index eff90a3..7bdab28 100644 (file)
@@ -156,14 +156,14 @@ sub send_to {
     my $msg_json = $msg->to_json;
     my $con = $self->primary_connection;
 
-    if ($recipient =~ /^opensrf:client/o) {
+    if ($recipient =~ /^opensrf:client/o || $recipient =~ /^opensrf:router/o) {
         # Clients may be lurking on remote nodes.
         # Make sure we have a connection to said node.
 
         # opensrf:client:domain:...
         my (undef, undef, $domain) = split(/:/, $recipient);
 
-        my $con = $self->get_connection($domain);
+        $con = $self->get_connection($domain);
         if (!$con) {
             $logger->error("Cannot send message to node $domain: $msg_json");
             return;