qmp: cleanup qmp queues properly
Marc-André Lureau reported that we can have this happen: 1. client1 connects, send command C1 2. client1 disconnects before getting response for C1 3. client2 connects, who might receive response of C1 However client2 should not receive remaining responses for client1. Basically, we should clean up the request/response queue elements when: - after a session is closed - before destroying the queues Some helpers are introduced to achieve that. We need to make sure we're with the lock when operating on those queues. This also needed the declaration of QMPRequest moved earlier. Reported-by: NMarc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: NPeter Xu <peterx@redhat.com> Message-Id: <20180326063901.27425-3-peterx@redhat.com> Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com> [eblake: drop pointless qmp_response_free(), drop queue flush on connect since a clean queue on disconnect is sufficient] Tested-by: NChristian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: NEric Blake <eblake@redhat.com>
Showing
想要评论请 注册 或 登录