Close event before closing socket.
Make new_user_handler() safe from LPC error().
Adding a check to prevent event loop reentrant.
Inlined logon(), and added some more debug information.
Reworked the debug problem, reverted hack.
Merge pull request #115 from sunyc/master

More fixes for alpha6