Check keep-alive twice as often

If I only check the socket once every KeepAlive seconds, I can go
nearly 2 * KeepAlive seconds without noticing I've not sent
anything. (If I send a packet immediately after sampling the socket,
then nothing, the next sample will show I've sent something, and only
the one after will detect a lack of activity)

So, check every KeepAlive/2 seconds instead, but only send a ping if
nothing has been sent for two such intervals. The longest I'll go
without noticing is nearly 3/2 KeepAlive seconds.