[PATCH] rwcancel: error should be provided by Unix function

liuhaichao at bytedance.com liuhaichao at bytedance.com
Tue Jul 2 11:12:17 CEST 2019


From: liuhaichao <liuhaichao at bytedance.com>

Change-Id: I7df1f9e0ce43dbe9c415e834757385dad2398707
---
 rwcancel/rwcancel.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rwcancel/rwcancel.go b/rwcancel/rwcancel.go
index 62397c2..3abfd0a 100644
--- a/rwcancel/rwcancel.go
+++ b/rwcancel/rwcancel.go
@@ -92,7 +92,7 @@ func (rw *RWCancel) Read(p []byte) (n int, err error) {
 			return n, err
 		}
 		if !rw.ReadyRead() {
-			return 0, errors.New("fd closed")
+			continue
 		}
 	}
 }
@@ -104,7 +104,7 @@ func (rw *RWCancel) Write(p []byte) (n int, err error) {
 			return n, err
 		}
 		if !rw.ReadyWrite() {
-			return 0, errors.New("fd closed")
+			continue
 		}
 	}
 }
-- 
2.19.1



More information about the WireGuard mailing list