From c2ceeb7e9358ae2d05a58f610e1e0739ed7c81e4 Mon Sep 17 00:00:00 2001 From: vyzo Date: Thu, 23 May 2019 15:09:36 +0300 Subject: [PATCH] add test assertion for closedRemote condition --- stream.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/stream.go b/stream.go index d19ee8e..aec86dd 100644 --- a/stream.go +++ b/stream.go @@ -69,6 +69,25 @@ func (s *Stream) preloadData() { } func (s *Stream) waitForData() error { + + // XXX test code + if s.closedRemote { + select { + case <-s.reset: + return streammux.ErrReset + case read, ok := <-s.dataIn: + if !ok { + return io.EOF + } + s.extra = read + s.exbuf = read + return nil + default: + panic("closed remote without a closed channel") + } + } + // XXX + select { case <-s.reset: // This is the only place where it's safe to return these.