Created by: bhaan
The current session event loop has a primitive approach toward handling outgoing messages sent from application code. A call to quickfix.SendToTarget
essentially adds the message to a queue, which the event loop picks up during it's next pass. This is limiting for applications that want to account for a message send failure, as there is no way for the event loop to communicate that back to application code.
These commits propose the following changes:
- Remove the
toSend
message queue - Add a dedicated channel in the event loop for sending messages.
- Have
SendToTarget
push messages to the event loop, and block on a corresponding error channel - Force the FromAdmin/App callback to occur on a dedicated goroutine. This creates separation between "application space" and "session space", and is required to prevent deadlocks on calls to
SendToTarget
during the FromAdmin/App callback. - Separate session state message handling into three parts: 1) Vaildation 2) FromAdmin/App callback 3) Processing for admin and rejected messages. This is required to enable the above changes.