Correct a deadlock bug as agent is waiting for connect response.