Skip to content

Commit

Permalink
add test assertion for closedRemote condition
Browse files Browse the repository at this point in the history
  • Loading branch information
vyzo committed May 23, 2019
1 parent 8917d60 commit c2ceeb7
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit c2ceeb7

Please sign in to comment.