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 );
}
sub handler {
my ($self, $session, $app_msg) = @_;
+ if( ! $app_msg ) {
+ return 0; # error?
+ }
+
$log->debug( "In Application::handler()", DEBUG );
my $app = $self->application_implementation;
$server_type ||= "basic";
if( $server_type eq "prefork" ) {
- $server_type = "Net::Server::PreForkSimple";
+ $server_type = "Net::Server::PreFork";
} else {
$server_type = "Net::Server::Single";
}
else {
my $apname = $app;
$apname =~ tr/[a-z]/[A-Z]/;
- $0 = "Unix Server ($apname)";
+ $0 = "OpenSRF App ($apname)";
eval _unixserver( $app );
exit;
}
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} );
}
sub toString {
my $self = shift;
- return $self->{msg_node}->toString(@_);
+ if( $self->{msg_node} ) {
+ return $self->{msg_node}->toString(@_);
+ }
+ return "";
}
sub get_body {
my $data; my $d;
while( $d = <STDIN> ) { $data .= $d; }
+ $0 = "$0*";
+
if( ! $data or ! defined( $data ) or $data eq "" ) {
throw OpenSRF::EX::Socket(
$logger->transport( "Timed out, disconnected, or auth failed", INFO );
$app_session->kill_me;
+
+ $0 =~ s/\*//g;
+
}