From: erickson Date: Thu, 3 Mar 2005 18:56:57 +0000 (+0000) Subject: added router 'unregister' loop to DESTROY X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=4f4b5fb850f1da36d0d1d3077d4c9290f2ca3fa2;p=opensrf%2Fbjwebb.git added router 'unregister' loop to DESTROY git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@167 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/perlmods/OpenSRF/Transport/SlimJabber/Inbound.pm b/src/perlmods/OpenSRF/Transport/SlimJabber/Inbound.pm index 13a9a7f..247326a 100644 --- a/src/perlmods/OpenSRF/Transport/SlimJabber/Inbound.pm +++ b/src/perlmods/OpenSRF/Transport/SlimJabber/Inbound.pm @@ -64,6 +64,29 @@ This service should be loaded at system startup. } } + +sub DESTROY { + my $self = shift; + + my $routers = $self->{routers}; #store for destroy + my $router_name = $self->{router_name}; + + unless($router_name and $routers) { + return; + } + + my @targets; + for my $router (@$routers) { + push @targets, "$router_name\@$router/router"; + } + + for my $router (@targets) { + if($self->tcp_connected()) { + $self->send( to => $router, body => "registering", + router_command => "unregister" , router_class => $self->{app} ); + } + } +} sub listen { my $self = shift; @@ -75,6 +98,9 @@ sub listen { my $conf = OpenSRF::Utils::Config->current; my $router_name = $conf->bootstrap->router_name; my $routers = $conf->bootstrap->domains; + + $self->{routers} = $routers; #store for destroy + $self->{router_name} = $router_name; unless($router_name and $routers) { throw OpenSRF::EX::Config