mirror of
https://github.com/amnezia-vpn/amneziawg-go.git
synced 2025-06-05 04:43:44 +02:00
wintun: Simplify Read method()
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
713477cfb1
commit
f05f52637f
1 changed files with 49 additions and 49 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue