From 11f4b7cd860abc2c99d90da6e9e2b0c767af0e6a Mon Sep 17 00:00:00 2001 From: xtaci Date: Fri, 2 Sep 2016 11:01:56 +0800 Subject: [PATCH] NumStream should return 0 when Closed --- session.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/session.go b/session.go index b3561e6..6cff757 100644 --- a/session.go +++ b/session.go @@ -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)