my $app = shift;
my $conf = OpenSRF::Utils::Config->current;
- my $router_name = $conf->bootstrap->router_name;
+ my $router_name = $conf->bootstrap->router_name || 'router';
my $routers = $conf->bootstrap->domains;
unless($router_name and $routers) {
use OpenSRF::EX;
use base qw( OpenSRF );
use OpenSRF::Utils::Logger qw(:level);
+use OpenSRF::Utils::Config;
use Time::HiRes qw(ualarm);
use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK);
use IO::Socket::INET;
+use IO::Socket::UNIX;
=head1 Description
</iq>
XML
+ my $sock_type = 'IO::Socket::INET';
+ unless ($port > 0) {
+ $sock_type = 'IO::Socket::UNIX';
+ }
# --- 5 tries to connect to the jabber server
my $socket;
for(1..5) {
$logger->transport( "$jid: Attempting to connect to server...$host:$port (Try # $_)", WARN );
- $socket = IO::Socket::INET->new( PeerHost => $host,
- PeerPort => $port,
- Proto => 'tcp' );
+ $socket = $sock_type->new( PeerHost => $host,
+ PeerPort => $port,
+ Peer => $port,
+ Proto => 'tcp' );
$logger->transport( "$jid: $_ connect attempt to $host:$port", WARN );
last if ( $socket and $socket->connected );
sleep 3;
my $username = $conf->bootstrap->username;
my $password = $conf->bootstrap->passwd;
- my $port = $conf->bootstrap->port;
+ my $port = $conf->bootstrap->port;
my $resource = "${app}_drone_at_$h";
- my $host = $domains->[0]; # XXX for now...
+ my $host = $domains->[0]; # XXX for now...
if( $app eq "client" ) { $resource = "client_at_$h"; }
+ unless ( $conf->bootstrap->router_name ) {
+ $username = 'router';
+ $resource = $app;
+ }
OpenSRF::EX::Config->throw( "JPeer could not load all necesarry values from config" )