If a session is shutdown when its command_state is already COMPLETE, session_handle_source_shutdown calls session_set_stopped, which calls session_command_complete which will submit the op at the head of commands again, despite it having already been submitted.
Given that only the op at the head of commands can be in the submitted state, tracking it as a command state makes more sense to me. And if the command state is SUBMITTED we know not to submit the op again.
* * *
Superceded !8270
-- v2: Apply 3 suggestion(s) to 1 file(s)