mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
net: add qemu_purge_queued_packets()
If net client sends packets asynchronously, it needs to purge its queued packets in cleanup() so as to prevent sent callbacks being invoked with a freed client. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
08b9d66b96
commit
8cad55161c
2 changed files with 17 additions and 0 deletions
16
net.c
16
net.c
|
@ -439,6 +439,22 @@ qemu_deliver_packet(VLANClientState *sender, const uint8_t *buf, int size)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void qemu_purge_queued_packets(VLANClientState *vc)
|
||||
{
|
||||
VLANPacket **pp = &vc->vlan->send_queue;
|
||||
|
||||
while (*pp != NULL) {
|
||||
VLANPacket *packet = *pp;
|
||||
|
||||
if (packet->sender == vc) {
|
||||
*pp = packet->next;
|
||||
qemu_free(packet);
|
||||
} else {
|
||||
pp = &packet->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void qemu_flush_queued_packets(VLANClientState *vc)
|
||||
{
|
||||
VLANPacket *packet;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue