add comments

This commit is contained in:
Andy Wang 2020-03-15 23:56:45 +00:00
parent db8dd19c9d
commit 47410dbb97

View File

@ -172,7 +172,7 @@ func (sesh *Session) closeStream(s *Stream, active bool) error {
log.Tracef("stream %v passively closed", s.id) log.Tracef("stream %v passively closed", s.id)
} }
sesh.streams.Store(s.id, nil) sesh.streams.Store(s.id, nil) // id may or may not exist. if we use Delete(s.id) here it will panic
if sesh.streamCountDecr() == 0 { if sesh.streamCountDecr() == 0 {
log.Debugf("session %v has no active stream left", sesh.id) log.Debugf("session %v has no active stream left", sesh.id)
go sesh.timeoutAfter(30 * time.Second) go sesh.timeoutAfter(30 * time.Second)
@ -205,6 +205,7 @@ func (sesh *Session) recvDataFromRemote(data []byte) error {
} }
return existingStreamI.(*Stream).writeFrame(*frame) return existingStreamI.(*Stream).writeFrame(*frame)
} else { } else {
// new stream
sesh.streamCountIncr() sesh.streamCountIncr()
sesh.acceptCh <- newStream sesh.acceptCh <- newStream
return newStream.writeFrame(*frame) return newStream.writeFrame(*frame)