Prevent maximum call stack size exceeded when LDAP server is stopped.

This pull request solves issue #41.