X-Git-Url: http://git.rot13.org/?p=virtual-ldap;a=blobdiff_plain;f=bin%2Fldap-koha.pl;h=640f06298edab996f3f8de9b3ae47c4b06571472;hp=e97e1efc2813012fcdb730755e08b2ba4ee86b1e;hb=ba90bc97b89ded491f5e44bd4a4b571ce36ba2fe;hpb=e48051e7f3498b10fe9c0f8e64dc7da5ecd01828 diff --git a/bin/ldap-koha.pl b/bin/ldap-koha.pl index e97e1ef..640f062 100755 --- a/bin/ldap-koha.pl +++ b/bin/ldap-koha.pl @@ -8,6 +8,17 @@ use IO::Socket; use lib 'lib'; use LDAP::Koha; +my $debug = $ENV{DEBUG} || 0; +$|=1; + +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( @@ -26,6 +37,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 {