wintun: Simplify Read method()
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
713477cfb1
commit
f05f52637f
|
@ -203,8 +203,9 @@ func (tun *nativeTun) Read(buff []byte, offset int) (int, error) {
|
||||||
select {
|
select {
|
||||||
case err := <-tun.errors:
|
case err := <-tun.errors:
|
||||||
return 0, err
|
return 0, err
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
if tun.rdNextPacket < tun.rdBuff.numPackets {
|
if tun.rdNextPacket < tun.rdBuff.numPackets {
|
||||||
// Get packet from the queue.
|
// Get packet from the queue.
|
||||||
|
@ -263,7 +264,6 @@ func (tun *nativeTun) Read(buff []byte, offset int) (int, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Note: flush() and putTunPacket() assume the caller comes only from a single thread; there's no locking.
|
// Note: flush() and putTunPacket() assume the caller comes only from a single thread; there's no locking.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue