Skip to content

Commit

Permalink
make sure close(conn) is before streamLock
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci authored and xtaci committed Apr 18, 2019
1 parent e12a73f commit 11b388c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion session.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,14 @@ func (s *Session) Close() (err error) {
return errors.New(errBrokenPipe)
default:
close(s.die)
err = s.conn.Close()
s.dieLock.Unlock()
s.streamLock.Lock()
for k := range s.streams {
s.streams[k].sessionClose()
}
s.streamLock.Unlock()
return s.conn.Close()
return
}
}

Expand Down

0 comments on commit 11b388c

Please sign in to comment.