简体   繁体   English

QuickFixN的会话断开事件不会调用OnLogout

[英]QuickFixN has session disconnection event that doesn't call OnLogout

In the QF event log there are session layer events: 在QF事件日志中,有会话层事件:

20180418-13:30:51.268 : Connection failed: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond #.#.#.#:#
20180418-13:31:00.288 : Connecting to #.#.#.# on port #
20180418-13:31:21.293 : Connection failed: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond #.#.#.#:#
20180418-13:31:00.288 : Connecting to #.#.#.# on port #

What's the event handler to use to report / react to these events? 用于报告这些事件/对这些事件做出反应的事件处理程序是什么? The OnLogout handler is not being called. 未调用OnLogout处理程序。

I don't want to use FromEarlyIntercept that I guess would catch the event? 我不想使用FromEarlyIntercept ,我想它将捕获该事件?

This behavior is by design - there was no connection established, no logon done, so no OnLogout event after network failure when connecting. 此行为是设计OnLogout -没有建立连接,没有完成登录,因此在连接出现网络故障后没有OnLogout事件。 You can see the source code for that part - FromEarlyIntercept is also not triggered in this case. 您可以看到该部分的源代码-在这种情况下,也不会触发FromEarlyIntercept QuickFix/n just logs the error and will try to reconnect after ReconnectInterval seconds. QuickFix / n仅记录错误,并在ReconnectInterval秒后尝试重新ReconnectInterval

try
        {
            t.Connect();
            t.Initiator.SetConnected(t.Session.SessionID);
            t.Session.Log.OnEvent("Connection succeeded");
            t.Session.Next();
            while (t.Read())
            { }
            if (t.Initiator.IsStopped)
                t.Initiator.RemoveThread(t);
            t.Initiator.SetDisconnected(t.Session.SessionID);
        }
        catch (IOException ex) // Can be exception when connecting, during ssl authentication or when reading
        {
            t.Session.Log.OnEvent("Connection failed: " + ex.Message);
        }
        catch (SocketException e) 
        {
            t.Session.Log.OnEvent("Connection failed: " + e.Message);
        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM