we now do an introspection lookup explicitly in math bench on child init
we build and tear down a connection in the unix:server configure hook so
that an applications 'initialize' method can do remote requests
inbound now only opens the socket after receiving data so that a restart
of a unix server won't require a restart of its companion listener process
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@98
9efc2488-bf62-4759-914b-
345cdb29e865
use strict;
use warnings;
+
+sub child_init {
+ OpenSRF::Application->method_lookup("opensrf.nunya");
+}
+
sub DESTROY{}
our $log = 'OpenSRF::Utils::Logger';
$SIG{HUP} = sub{ instance()->hupall(); };
-#$SIG{CHLD} = \&process_automation;
+$SIG{CHLD} = \&process_automation;
{
if( $newpid ) {
$self->pid_hash( $newpid, $method );
}
- else { $0 = $method; eval $method; exit; }
+ else { eval $method; exit; }
}
}
}
else {
my $apname = "settings";
- $apname =~ tr/[a-z]/[A-Z]/;
$0 = "OpenSRF App ($apname)";
eval _unixserver( "settings" );
if($@) { die "$@\n"; }
}
else {
my $apname = $app;
- $apname =~ tr/[a-z]/[A-Z]/;
- $0 = "Listener ($apname)";
+ $0 = "OpenSRF listener ($apname)";
eval _listener( $app );
exit;
}
}
else {
my $apname = $app;
- $apname =~ tr/[a-z]/[A-Z]/;
$0 = "OpenSRF App ($apname)";
eval _unixserver( $app );
exit;
}
else {
my $apname = $app;
- $apname =~ tr/[a-z]/[A-Z]/;
$0 = "Listener ($apname)";
- warn "Launching Listener with command:\n " . _listener($app) . "\n";
eval _listener( $app );
exit;
}
unless( $self->{_socket}->connected ) {
OpenSRF::EX::JabberDisconnected->throw(
- "This JabberClient instance is no longer connected to the server", ERROR );
+ "This JabberClient instance is no longer connected to the server " .
+ $self->username . " : " . $self->resource, ERROR );
}
my $val = $self->timed_read( $timeout );
$logger->transport( $self->{app} . " going into listen loop", INFO );
while(1) {
- my $sock = $self->unix_sock();
- my $socket = IO::Socket::UNIX->new( Peer => $sock );
- throw OpenSRF::EX::Socket( "Unable to connect to UnixServer: socket-file: $sock \n :=> $! " )
- unless ($socket->connected);
-
+ my $sock = $self->unix_sock();
my $o = $self->process( -1 );
if( ! defined( $o ) ) {
throw OpenSRF::EX::Jabber( "Listen Loop failed at 'process()'" );
}
- print $socket $o;
+ my $socket = IO::Socket::UNIX->new( Peer => $sock );
+ throw OpenSRF::EX::Socket( "Unable to connect to UnixServer: socket-file: $sock \n :=> $! " )
+ unless ($socket->connected);
+ print $socket $o;
$socket->close;
}
my $app = $self->app();
+ $0 = "OpenSRF master ($app)";
+
my $client = OpenSRF::Utils::SettingsClient->new();
$logger->transport("Max Req: " . $client->config_value("apps", $app, "unix_config", "max_requests" ), INFO );
sub child_init_hook {
- $0 = "$0_child";
+ $0 =~ s/master/drone/g;
my $self = shift;
- $logger->transport(
- "Creating PeerHandle from UnixServer child_init_hook", INTERNAL );
+# $logger->transport(
+# "Creating PeerHandle from UnixServer child_init_hook", INTERNAL );
OpenSRF::Transport::PeerHandle->construct( $self->app() );
$logger->transport( "PeerHandle Created from UnixServer child_init_hook", INTERNAL );