X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;ds=sidebyside;f=bin%2Fldap-koha.pl;h=30c2c9e003fb21f2f937480e88f9e2b5c67b755f;hb=9d36c5db63043dde1160fae994845f2913f42ac7;hp=40c64d651255c65f376e36383d31b1f4688fae0d;hpb=fc93087a8d0925aaab323e7d9a2f38be6a962992;p=virtual-ldap diff --git a/bin/ldap-koha.pl b/bin/ldap-koha.pl index 40c64d6..30c2c9e 100755 --- a/bin/ldap-koha.pl +++ b/bin/ldap-koha.pl @@ -8,14 +8,24 @@ use IO::Socket; use lib 'lib'; use LDAP::Koha; -my $listen = '10.60.0.13:2389'; +my $debug = $ENV{DEBUG} || 0; + +BEGIN { + $SIG{'__WARN__'} = sub { + my $level = $1 if $_[0] =~ m/^(#+)/; + return if defined($level) && length($level) > $debug; + + warn join("\n", @_); + }; +} +my $listen = shift @ARGV || 'localhost:2389'; my $sock = IO::Socket::INET->new( Listen => 5, Proto => 'tcp', Reuse => 1, LocalAddr => $listen, -) || die; +) || die "can't listen to $listen $!"; warn "# listening on $listen"; @@ -26,6 +36,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 {