From c76d829b387ef68e39bf8d271268164d35f75dcd Mon Sep 17 00:00:00 2001 From: Zachary Zhao Date: Thu, 24 Nov 2022 19:25:00 +0800 Subject: [PATCH] In this commit a CloseChan function is added to session module By this using this funcion, one can be notified immediately when a session is closed. --- session.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/session.go b/session.go index de0c69b..778e24b 100644 --- a/session.go +++ b/session.go @@ -207,6 +207,12 @@ func (s *Session) Close() error { } } +// CloseChan can be used by someone who wants to be notified immediately when this +// session is closed +func (s *Session) CloseChan() <-chan struct{} { + return s.die +} + // notifyBucket notifies recvLoop that bucket is available func (s *Session) notifyBucket() { select {