Development discussion of WireGuard
 help / color / mirror / Atom feed
From: liuhaichao@bytedance.com
To: wireguard@lists.zx2c4.com
Cc: liuhaichao <liuhaichao@bytedance.com>
Subject: [PATCH] rwcancel: error should be provided by Unix function
Date: Tue,  2 Jul 2019 17:12:05 +0800	[thread overview]
Message-ID: <5d1b1fee.1c69fb81.3719e.5260@mx.google.com> (raw)

From: liuhaichao <liuhaichao@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

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

                 reply	other threads:[~2019-07-17 20:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5d1b1fee.1c69fb81.3719e.5260@mx.google.com \
    --to=liuhaichao@bytedance.com \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).