[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-commits] [COMMIT 8cad551] net: add qemu_purge_queued_packets()
From: |
Anthony Liguori |
Subject: |
[Qemu-commits] [COMMIT 8cad551] net: add qemu_purge_queued_packets() |
Date: |
Mon, 22 Jun 2009 15:51:11 -0000 |
From: Mark McLoughlin <address@hidden>
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 <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>
diff --git a/net.c b/net.c
index 5b092c7..cea545e 100644
--- a/net.c
+++ b/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;
diff --git a/net.h b/net.h
index 3fbfdba..484b000 100644
--- a/net.h
+++ b/net.h
@@ -70,6 +70,7 @@ ssize_t qemu_sendv_packet_async(VLANClientState *vc, const
struct iovec *iov,
void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size);
ssize_t qemu_send_packet_async(VLANClientState *vc, const uint8_t *buf,
int size, NetPacketSent *sent_cb);
+void qemu_purge_queued_packets(VLANClientState *vc);
void qemu_flush_queued_packets(VLANClientState *vc);
void qemu_format_nic_info_str(VLANClientState *vc, uint8_t macaddr[6]);
void qemu_check_nic_model(NICInfo *nd, const char *model);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-commits] [COMMIT 8cad551] net: add qemu_purge_queued_packets(),
Anthony Liguori <=