From 8d5ec9c63cf576658593ae047771e2f94d30d8fa Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 8 Feb 2005 15:14:54 +0000 Subject: [PATCH] some sanity checking, syntax error fixups git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@28 9efc2488-bf62-4759-914b-345cdb29e865 --- src/perlmods/OpenSRF/AppSession.pm | 1 + src/perlmods/OpenSRF/Application.pm | 4 ++++ src/perlmods/OpenSRF/System.pm | 4 ++-- src/perlmods/OpenSRF/Transport/SlimJabber/Inbound.pm | 2 +- src/perlmods/OpenSRF/Transport/SlimJabber/MessageWrapper.pm | 5 ++++- src/perlmods/OpenSRF/UnixServer.pm | 5 +++++ 6 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/perlmods/OpenSRF/AppSession.pm b/src/perlmods/OpenSRF/AppSession.pm index e0b03a2..ff191fa 100644 --- a/src/perlmods/OpenSRF/AppSession.pm +++ b/src/perlmods/OpenSRF/AppSession.pm @@ -754,6 +754,7 @@ sub threadTrace { sub push_queue { my $self = shift; my $resp = shift; + if( !$resp ) { return 0; } push @{ $self->{recv_queue} }, $resp; OpenSRF::Utils::Logger->debug( "AppRequest pushed ".$resp->toString(), INTERNAL ); } diff --git a/src/perlmods/OpenSRF/Application.pm b/src/perlmods/OpenSRF/Application.pm index dbc3f5c..1adc67d 100644 --- a/src/perlmods/OpenSRF/Application.pm +++ b/src/perlmods/OpenSRF/Application.pm @@ -34,6 +34,10 @@ sub application_implementation { sub handler { my ($self, $session, $app_msg) = @_; + if( ! $app_msg ) { + return 0; # error? + } + $log->debug( "In Application::handler()", DEBUG ); my $app = $self->application_implementation; diff --git a/src/perlmods/OpenSRF/System.pm b/src/perlmods/OpenSRF/System.pm index cf2d2d8..9871950 100644 --- a/src/perlmods/OpenSRF/System.pm +++ b/src/perlmods/OpenSRF/System.pm @@ -132,7 +132,7 @@ sub bootstrap { $server_type ||= "basic"; if( $server_type eq "prefork" ) { - $server_type = "Net::Server::PreForkSimple"; + $server_type = "Net::Server::PreFork"; } else { $server_type = "Net::Server::Single"; } @@ -259,7 +259,7 @@ sub launch_unix { else { my $apname = $app; $apname =~ tr/[a-z]/[A-Z]/; - $0 = "Unix Server ($apname)"; + $0 = "OpenSRF App ($apname)"; eval _unixserver( $app ); exit; } diff --git a/src/perlmods/OpenSRF/Transport/SlimJabber/Inbound.pm b/src/perlmods/OpenSRF/Transport/SlimJabber/Inbound.pm index 9851b7b..331c9eb 100644 --- a/src/perlmods/OpenSRF/Transport/SlimJabber/Inbound.pm +++ b/src/perlmods/OpenSRF/Transport/SlimJabber/Inbound.pm @@ -70,7 +70,7 @@ sub listen { my $config = OpenSRF::Utils::Config->current; my $routers = $config->system->router_target; if (defined $routers) { - for my $router (@$routers) P + for my $router (@$routers) { $self->send( to => $router, body => "registering", router_command => "register" , router_class => $self->{app} ); } diff --git a/src/perlmods/OpenSRF/Transport/SlimJabber/MessageWrapper.pm b/src/perlmods/OpenSRF/Transport/SlimJabber/MessageWrapper.pm index 7ac8f3a..1dd25fd 100644 --- a/src/perlmods/OpenSRF/Transport/SlimJabber/MessageWrapper.pm +++ b/src/perlmods/OpenSRF/Transport/SlimJabber/MessageWrapper.pm @@ -25,7 +25,10 @@ sub new { sub toString { my $self = shift; - return $self->{msg_node}->toString(@_); + if( $self->{msg_node} ) { + return $self->{msg_node}->toString(@_); + } + return ""; } sub get_body { diff --git a/src/perlmods/OpenSRF/UnixServer.pm b/src/perlmods/OpenSRF/UnixServer.pm index 18ad380..b6a4b28 100644 --- a/src/perlmods/OpenSRF/UnixServer.pm +++ b/src/perlmods/OpenSRF/UnixServer.pm @@ -60,6 +60,8 @@ sub process_request { my $data; my $d; while( $d = ) { $data .= $d; } + $0 = "$0*"; + if( ! $data or ! defined( $data ) or $data eq "" ) { throw OpenSRF::EX::Socket( @@ -110,6 +112,9 @@ sub process_request { $logger->transport( "Timed out, disconnected, or auth failed", INFO ); $app_session->kill_me; + + $0 =~ s/\*//g; + } -- 2.11.0