vepkt() clean up - vx32 - Local 9vx git repository for patches.
Log
Files
Refs
---
commit 2e3c2eaf6479d04ef5e64fe6bdfc6bd78abdc663
parent 0916a877d6a3987677fcc99301d03732bc4feb86
Author: Jesus Galan Lopez (yiyus) 
Date:   Sat, 12 Jun 2010 16:30:12 +0200

vepkt() clean up

Diffstat:
  src/9vx/etherve.c                   |      13 +++++++------

1 file changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/9vx/etherve.c b/src/9vx/etherve.c
@@ -86,18 +86,19 @@ vepkt(Ctlr *c)
         struct pcap_pkthdr hdr;
         Block *b;
 
+        static int fn=0;
+
         b = allocb(65000);
         while ((b->rp = pcap_next(c->pd, &hdr)) == nil) ;
+        if(hdr.caplen == 0)
+                return nil;
 
-        if (hdr.caplen) {
-                b->wp = b->rp+hdr.caplen;
+        b->wp = b->rp+hdr.caplen;        // XXX ?
 
-                iprint("Got packet (ts=%d) len %d / %d\n", hdr.ts.tv_sec , hdr.caplen, hdr.len);
+        iprint("Got packet %d (len %d)\n", ++fn, hdr.caplen);
 
-                return b;
-        }
+        return b;
 
-        return nil;
 }
 
 static void