fix for write_nonblocking_socket to prevent hangs if blocking fd is passed and client stops reading