X-Git-Url: http://git.rot13.org/?p=virtual-ldap;a=blobdiff_plain;f=bin%2Fldap-koha.pl;h=e9ed1f997f5eedaed6ab9bf480741975a87a4440;hp=d50ebbca4655db00bb2134fb11ffee9ec87d3091;hb=7d518276a9432fc210d9400de6695ebab8d9e5b4;hpb=97697527827da534e72c5ed16d577df9ff21f837 diff --git a/bin/ldap-koha.pl b/bin/ldap-koha.pl index d50ebbc..e9ed1f9 100755 --- a/bin/ldap-koha.pl +++ b/bin/ldap-koha.pl @@ -8,16 +8,16 @@ use IO::Socket; use lib 'lib'; use LDAP::Koha; -my $port = 2389; +my $listen = shift @ARGV || 'localhost:2389'; my $sock = IO::Socket::INET->new( Listen => 5, Proto => 'tcp', Reuse => 1, - LocalPort => $port, -) || die; + LocalAddr => $listen, +) || die "can't listen to $listen $!"; -warn "# listening on $port"; +warn "# listening on $listen"; my $sel = IO::Select->new($sock); my %Handlers; @@ -26,6 +26,7 @@ while (my @ready = $sel->can_read) { if ($fh == $sock) { # let's create a new socket my $psock = $sock->accept; + $psock->sockopt(SO_KEEPALIVE,1); $sel->add($psock); $Handlers{*$psock} = LDAP::Koha->new($psock); } else {