set connection state ~atomically, preventing race condition in setup threads