In Session::start, fix8 sends a Logon message and then changes state to logon_sent:
send(generate_logon(_connection->get_hb_interval(), davi));
do_state_change(States::st_logon_sent);
In Session::handle_logon, upon receiving a Logon message, fix8 changes state to continuous if it is the initiator.
Normally, the state transition is as follows:
not_logged_in
-> logon_sent
-> logon_received
-> continuous
However, if Session::start and Session::handle_logon are run on separate threads, which is common among low latency systems, Session::handle_logon may set the state to continuous before Session::start set it to logon_sent. This results in the Session ends up in logon_sent rather than continous:
not_logged_in
-> logon_received
-> continuous
Session::_state being atomic can't avert the race condition. Is there a way to fix the issue? Or the two methods are not supposed to run on different threads?