summaryrefslogtreecommitdiff
path: root/Kolab-LDAP-Backend-slurpd/slurpd.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Kolab-LDAP-Backend-slurpd/slurpd.pm')
-rw-r--r--Kolab-LDAP-Backend-slurpd/slurpd.pm22
1 files changed, 14 insertions, 8 deletions
diff --git a/Kolab-LDAP-Backend-slurpd/slurpd.pm b/Kolab-LDAP-Backend-slurpd/slurpd.pm
index 333afb1..d6bd14e 100644
--- a/Kolab-LDAP-Backend-slurpd/slurpd.pm
+++ b/Kolab-LDAP-Backend-slurpd/slurpd.pm
@@ -274,16 +274,23 @@ sub run
my $ready;
my $offset = 0;
- if (!($select->can_read(1)) && $changes) {
- $changes = 0;
- Kolab::log('SD', 'Change detected w/ no pending LDAP messages; reloading services if needed');
- Kolab::LDAP::sync;
- system($Kolab::config{'prefix'} . '/sbin/kolabconf');
- }
+
+ if (!($select->can_read(0)) && $changes) {
+ Kolab::log('SD', 'Change detected w/ no pending LDAP messages; waiting a second...');
+ if( !($select->can_read(1)) ) {
+ $changes = 0;
+ Kolab::log('SD', 'Change detected w/ no pending LDAP messages; reloading services if needed');
+ Kolab::LDAP::sync;
+ Kolab::log('SD', 'Running kolabconf');
+ system($Kolab::config{'prefix'} ."/sbin/kolabconf") == 0
+ or Kolab::log('SD', "Failed to run kolabconf: $?", KOLAB_ERROR);
+ Kolab::log('SD', 'Kolabconf complete');
+ }
+ }
Kolab::log('SD', 'Waiting for LDAP updates');
- for ($ready = 1; $conn && $ready; $ready = $select->can_read(1)) {
+ for ($ready = 1; $conn && $ready; $ready = $select->can_read(0)) {
Kolab::log('SD', 'Reading ASN', KOLAB_DEBUG);
my $newoffset = asn_read($conn, $pdu, $offset);
if( !$conn->connected() or $offset == $newoffset ) {
@@ -293,7 +300,6 @@ sub run
}
$offset = $newoffset;
defined($offset) or $offset = 0;
- sleep 1;
}
if ($pdu) {