Add flag to signal disconnection, as assignment to the needs_reconnect flag can race with on_error.