qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 03/13] net: vlan clients with no fd_can_read() can a


From: Mark McLoughlin
Subject: [Qemu-devel] [PATCH 03/13] net: vlan clients with no fd_can_read() can always receive
Date: Tue, 19 May 2009 10:55:25 +0100

If a vlan client has no fd_can_read(), that means it can
always receive packets. The current code assumes it can *never*
receive packets.

Signed-off-by: Mark McLoughlin <address@hidden>
---
 net.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/net.c b/net.c
index 3f9062f..a3f4674 100644
--- a/net.c
+++ b/net.c
@@ -389,15 +389,19 @@ VLANClientState *qemu_find_vlan_client(VLANState *vlan, 
void *opaque)
     return NULL;
 }
 
-int qemu_can_send_packet(VLANClientState *vc1)
+int qemu_can_send_packet(VLANClientState *sender)
 {
-    VLANState *vlan = vc1->vlan;
+    VLANState *vlan = sender->vlan;
     VLANClientState *vc;
 
-    for(vc = vlan->first_client; vc != NULL; vc = vc->next) {
-        if (vc != vc1) {
-            if (vc->fd_can_read && vc->fd_can_read(vc->opaque))
-                return 1;
+    for (vc = vlan->first_client; vc != NULL; vc = vc->next) {
+        if (vc == sender) {
+            continue;
+        }
+
+        /* no fd_can_read() handler, they can always receive */
+        if (!vc->fd_can_read || vc->fd_can_read(vc->opaque)) {
+            return 1;
         }
     }
     return 0;
-- 
1.6.0.6





reply via email to

[Prev in Thread] Current Thread [Next in Thread]