Revamp heartbeat handling

Be conservative in heartbeat behavior: send at the minimum interval
negotiated by the server and the client, and do not artificially abort a
connection if we do not receive any heartbeats.

If this looks OK, I can add a port of `time.monotonic` and use that in a subsequent commit.