How to handle peer death in TCP connection