1

我在 quickfixn github 页面上的 Tradeclient 示例上编写了一个交易应用程序。它现在被大量修改,但关于登录和注销它没有改变。我现在遇到的问题是,当按下注销按钮时,它会调用 Initiator.Stop,但它并没有像预期的那样进入 OnLogout。登录时一切正常,initiator.start,然后是 OnCreate,然后是 OnLogon,但在注销时,不会触发 OnLogout。任何想法可能是什么问题?

    private void Disconnect(object ignored)
    {
        Trace.WriteLine("ConnectionViewModel::Disconnect called");
        _qfapp.Stop();
    }

    public void Stop()
    {
        Trace.WriteLine("QFApp::Stop() called");
        Initiator.Stop(true);
    }

    public void OnLogout(QuickFix.SessionID sessionID)
    {
        // not sure how ActiveSessionID could ever be null, but it happened.
        string a = (this.ActiveSessionID == null) ? "null" : this.ActiveSessionID.ToString();
        Trace.WriteLine(String.Format("==OnLogout: {0}==", a));

        if (LogoutEvent != null)
        {
            LogoutEvent();
        }
    }
4

1 回答 1

0

这里的答案与 DumbCoder 相同。Initiator.Stop(true);停止启动器引擎,因此所有会话都断开连接。这意味着没有更多的会话可以注销。

根据这个答案,您首先要使用注销会话

Session.lookupSession(sessionID).logout();

然而,根据格兰特的评论,这是一件不寻常的事情。我的猜测是 onLogout() 功能实际上是在客户端会话从接受器注销时捕获,但接受器本身仍在运行。这不是真正的发起方。

于 2017-01-23T17:54:16.173 回答