From 67e59cb35c661c3cd5ff05706bf0e707c8ae3ad3 Mon Sep 17 00:00:00 2001 From: MoofMonkey <11695747+MoofMonkey@users.noreply.github.com> Date: Wed, 5 Oct 2022 02:31:09 +0300 Subject: [PATCH] Clean up shutdownSessions --- datagramsession/manager.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/datagramsession/manager.go b/datagramsession/manager.go index a315909c..765a4ec3 100644 --- a/datagramsession/manager.go +++ b/datagramsession/manager.go @@ -88,10 +88,10 @@ func (m *manager) shutdownSessions(err error) { } closeSessionErr := &errClosedSession{ message: err.Error(), + // Usually connection with remote has been closed, so set this to true to skip unregistering from remote + // context.Canceled is an exception because that means session is being closed by our side + byRemote: !errors.Is(err, context.Canceled), } - // Usually connection with remote has been closed, so set this to true to skip unregistering from remote - // context.Canceled is an exception because that means session is being closed by our side - closeSessionErr.byRemote = !errors.Is(err, context.Canceled) for _, s := range m.sessions { s.close(closeSessionErr) }