In Syncroton Ping/Sync requests can stay running for 6 or 15 or even 30 minutes. This depends on a device and configuration. In this time we do a loop with 60 seconds intervals when we sleep and wakeup again to detect changes on the account. This means we keep connections to IMAP, SQL, memcache, LDAP open all that time.
This creates a lot of open connections on a system with many users/devices. We should close connections before we "goto sleep" and connect again "on wakeup". This shouldn't be hard as database, memcache and IMAP handlers in Roundcube Framework have re-connection built-in.
So, we need:
- Create rcube::sleep() method that will drop all connections used by the framework (in proper order).
- Update Syncroton to call rcube::sleep() before doing sleep() in Ping/Sync handler.
- Drop ldap connection used by kolab_auth plugin as soon as possible. We need it only for authentication once a request. Maybe using some new plugin API hook in rcube::sleep().