From 717db3f9e8d90388e1863b3bc3acec90b5c6e829 Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 29 Mar 2005 21:12:26 +0000 Subject: [PATCH] adding full_request (not sure if we need this) and fixing thinko on disconnect git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@251 9efc2488-bf62-4759-914b-345cdb29e865 --- src/perlmods/OpenSRF/AppSession.pm | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/src/perlmods/OpenSRF/AppSession.pm b/src/perlmods/OpenSRF/AppSession.pm index 1b6b557..0aafffd 100644 --- a/src/perlmods/OpenSRF/AppSession.pm +++ b/src/perlmods/OpenSRF/AppSession.pm @@ -381,11 +381,7 @@ sub kill_me { sub disconnect { my $self = shift; - return unless $self; - unless( $self->state == DISCONNECTED ) { - $self->send('DISCONNECT', "") if ($self->endpoint == CLIENT);; - $self->state( DISCONNECTED ); - } + # run each 'disconnect' callback; if (exists $self->{callbacks}{disconnect}) { for my $sub (values %{$self->{callbacks}{disconnect}}) { @@ -393,6 +389,11 @@ sub disconnect { } } + unless( $self->state == DISCONNECTED ) { + $self->send('DISCONNECT', "") if ($self->endpoint == CLIENT);; + $self->state( DISCONNECTED ); + } + $self->reset; } @@ -413,6 +414,21 @@ sub request { $self->send('REQUEST',$method); } +sub full_request { + my $self = shift; + my $meth = shift; + + my $method; + if (!ref $meth) { + $method = new OpenSRF::DomainObject::oilsMethod ( method => $meth ); + } else { + $method = $meth; + } + + $method->params( @_ ); + + $self->send(CONNECT => '', REQUEST => $method, DISCONNECT => ''); +} sub send { my $self = shift; @@ -445,7 +461,7 @@ sub send { if ($msg_type eq 'DISCONNECT' ) { $disconnect++; - if( $self->state == DISCONNECTED) { + if( $self->state == DISCONNECTED && !$connecting) { next; } } @@ -503,7 +519,6 @@ sub send { } } } - $logger->debug( "AppSession sending doc: " . $doc->toString(), INTERNAL ); @@ -512,6 +527,10 @@ sub send { thread => $self->session_id, body => $doc->toString ); + if( $disconnect) { + $self->state( DISCONNECTED ); + } + return $self->app_request( $tT ); } -- 2.11.0