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.