]> Cypherpunks.ru repositories - govpn.git/blobdiff - src/cypherpunks.ru/govpn/tap_android.go
fix close by interrupt read, do not close multiple times
[govpn.git] / src / cypherpunks.ru / govpn / tap_android.go
index 15c5940f7648819eeffb8e1c6bdaee1123e182b2..1530d2e2cae2047e5f6fa011bfe72b2b0c5f61b4 100644 (file)
@@ -53,6 +53,10 @@ func TapListenFileDescriptor(fd uintptr, ifaceName string, mtu int) *TAP {
                        bufZ = !bufZ
                        n, err = tap.dev.Read(buf)
                        if err != nil {
+                               if tap.closed {
+                                       return
+                               }
+
                                e, ok := err.(*os.PathError)
                                if ok && e.Err == syscall.EAGAIN {
                                        time.Sleep(time.Millisecond * 20)