RE: [Quickfix-developers] SocketInitiator.stop()
Brought to you by:
orenmnero
From: Patrick F. <pat...@ch...> - 2005-03-23 17:53:16
|
Oren, Thanks much for your reply. I will try to explain your question about the flag. The unmanaged C++ version of Initiator::stop(bool force) sets force to a default value of false (Initiator.cpp line 184). The .NET version of SocketInitiator.stop() (SocketInitiator.h line 111)calls the unmanaged stop without ever setting this parameter or allowing the user to set it. This seems to cause the .NET initiator stop function to wait infinitely. Also if you call Session.lookupSession(mySession).logout(); to end a session should you be calling Session.lookupSession(mySession).logon(); to initiate a session instead of sending the logon message ? Patrick Flannery _____ From: Oren Miller [mailto:or...@qu...] Sent: Wednesday, March 23, 2005 11:26 AM To: Patrick Flannery; qui...@li... Cc: joh...@ch... Subject: Re: [Quickfix-developers] SocketInitiator.stop() Patrick, You shouldn't be sending you're own logon and logout messages. QuickFIX does this for you. Instead you should be sending your applications logon message in the onLogon callback, which is when the FIX sessions have succesfully handshaked. And when you log off, you should use the logoff call instead of sending your own logoff message. What flag are you refering to? --oren ----- Original Message ----- From: Patrick Flannery <mailto:pat...@ch...> To: qui...@li... <mailto:qui...@li...> Sent: Friday, March 18, 2005 1:56 PM Subject: [Quickfix-developers] SocketInitiator.stop() Hello, There were some recent messages about the SocketInitiator::stop() causing a deadlock. An update was posted in cvs where the code has a flag allowing the user to force a close. The C# version of SocketInitiator does not have this same flag and may be needed because the SocketInitiator.stop() function deadlocks. Also, and this is real simple, is this correct way to start a fix session? void start(){ initiator.start(); //Wait for the FIX.onLogon(Session ) to be signaled. WaitForConnect(CONNECT_TIMEOUT); //Fix logon QuickFix44.Logon fixLogon = new Logon(); fix.Send(fixLogon); //Application Logon QuickFix44.UserRequest logon = new QuickFix44.UserRequest(); QuoterParamaters fields = new QuoterParamaters(credentials); Set(logon, new UserRequestType(UserRequestType.LOGONUSER));//Set the logon flag to true fix.Send(logon); } With a corresponding stop: void stop() { //Application Logoff QuickFix44.UserRequest logoff = new QuickFix44.UserRequest (); Set(logoff, new UserRequestType(UserRequestType.LOGOFFUSER)); fix.Send(logoff); //Fix logoff if(fix.LoggedOn) { QuickFix44.Logout fixLogout = new Logout(); fix.Send(fixLogout); } /** * This causes the thread to hang. * */ initiator.stop(); } Thanks in advance. Patrick Flannery |