From 6f08a100410fb61093df5321b685b07ff8b801e6 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 9 Feb 2021 20:18:21 +0100 Subject: rwcancel: add an explicit close call This lets us collect FDs even if the GC doesn't do it for us. Signed-off-by: Jason A. Donenfeld --- rwcancel/rwcancel.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'rwcancel/rwcancel.go') diff --git a/rwcancel/rwcancel.go b/rwcancel/rwcancel.go index 8a6300a..70eb4ca 100644 --- a/rwcancel/rwcancel.go +++ b/rwcancel/rwcancel.go @@ -119,3 +119,8 @@ func (rw *RWCancel) Cancel() (err error) { _, err = rw.closingWriter.Write([]byte{0}) return } + +func (rw *RWCancel) Close() { + rw.closingReader.Close() + rw.closingWriter.Close() +} -- cgit v1.2.3-59-g8ed1b