From 61bab49b5ef27addfac50f2f85b286641968b420 Mon Sep 17 00:00:00 2001 From: Hanne Moa Date: Thu, 4 Jul 2024 15:16:37 +0200 Subject: [PATCH] Close connections with greater paranoia --- src/zinolib/controllers/zino1.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/zinolib/controllers/zino1.py b/src/zinolib/controllers/zino1.py index cea3e88..6b6d0d4 100644 --- a/src/zinolib/controllers/zino1.py +++ b/src/zinolib/controllers/zino1.py @@ -297,14 +297,15 @@ def authenticate(session, username=None, password=None): @staticmethod def close_push_channel(session): - if hasattr(session.push, '_sock'): + if hasattr(session, 'push') and hasattr(session.push, '_sock'): session.push._sock.close() session.push = None @classmethod def close_session(cls, session): cls.close_push_channel(session) - session.request.close() + if hasattr(session, 'request'): + session.request.close() session.request = None return None