Description of problem: On receiving a sync() command, the broker responds immediately. It does not wait for async message enqueues to complete. This could give incorrect sync results when used with the async store, causing hard-to-find intermittent bugs. Summary of code changes: - Generalize IncompleteMessageList on SessionState to an incomplete command list that can include both message enqueus and syncs. - Update subsequent pending syncs during message completion. - Send sync when all preceding async messages have completed.
Current code actually already does what is required; on receiving a sync() the broker will indeed wait until all outstanding enqueues are complete before responding.