NumStream should return 0 when Closed

This commit is contained in:
xtaci
2016-09-02 11:01:56 +08:00
parent 6d6a24b866
commit 11f4b7cd86
+3
View File
@@ -125,6 +125,9 @@ func (s *Session) IsClosed() bool {
// NumStreams returns the number of currently open streams
func (s *Session) NumStreams() int {
if s.IsClosed() {
return 0
}
s.streamLock.Lock()
defer s.streamLock.Unlock()
return len(s.streams)