wintun: Simplify Read method()

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2019-02-08 14:31:05 +01:00
parent 713477cfb1
commit f05f52637f

View file

@ -203,8 +203,9 @@ func (tun *nativeTun) Read(buff []byte, offset int) (int, error) {
select {
case err := <-tun.errors:
return 0, err
default:
}
for {
if tun.rdNextPacket < tun.rdBuff.numPackets {
// Get packet from the queue.
@ -262,7 +263,6 @@ func (tun *nativeTun) Read(buff []byte, offset int) (int, error) {
continue
}
}
}
}
// Note: flush() and putTunPacket() assume the caller comes only from a single thread; there's no locking.