在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 #
用于报告/响应这些事件的事件处理程序是什么? OnLogout
处理程序未被调用。
我不想使用我想会抓住事件的FromEarlyIntercept
吗?
答案 0 :(得分:2)
此行为是设计使然-没有建立连接,没有完成登录,因此在连接失败时网络出现故障后没有发生OnLogout
事件。
您可以看到该部分的源代码-在这种情况下也不会触发FromEarlyIntercept
。 QuickFix / n只会记录错误,并在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);
}