handle the case where only one service is registered for a given router
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 22 Dec 2008 20:27:27 +0000 (20:27 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 22 Dec 2008 20:27:27 +0000 (20:27 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1561 9efc2488-bf62-4759-914b-345cdb29e865

src/perl/lib/OpenSRF/Transport/SlimJabber/Inbound.pm

index 3f08653..e9eed2f 100644 (file)
@@ -97,7 +97,11 @@ sub listen {
 
         for my $router (@$routers) {
             if(ref $router) {
-                if( !$router->{services} || grep { $_ eq $self->{app} } @{$router->{services}->{service}} ) {
+                if( !$router->{services} || 
+                        ( ref($router->{services}) eq 'ARRAY' and 
+                            grep { $_ eq $self->{app} } @{$router->{services}->{service}} )  ||
+                        $router->{services}->{service} eq $self->{app}) {
+
                     my $name = $router->{name};
                     my $domain = $router->{domain};
                     my $target = "$name\@$domain/router";
@@ -114,7 +118,8 @@ sub listen {
         }
                
        } catch Error with {
-               $logger->transport( $self->{app} . ": No routers defined" , WARN ); 
+        my $err = shift;
+               $logger->error($self->{app} . ": No routers defined: $err");
                # no routers defined
        };