Fix crash when scheduling periodics.
Implement client-side ping timeout.

This fixes #13.