Mercurial > libervia-backend
changeset 3133:87b8808ac49d
plugin XEP-0198: don't crash when xmlstream has been closed
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 28 Jan 2020 22:26:12 +0100 |
parents | b64dd7c1496d |
children | 48eafdab1c34 |
files | sat/plugins/plugin_xep_0198.py |
diffstat | 1 files changed, 11 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0198.py Mon Jan 27 19:53:31 2020 +0100 +++ b/sat/plugins/plugin_xep_0198.py Tue Jan 28 22:26:12 2020 +0100 @@ -1,8 +1,7 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# SàT plugin for managing raw XML log -# Copyright (C) 2011 Jérôme Poisson (goffi@goffi.org) +# SàT plugin for managing Stream-Management +# Copyright (C) 2009-2020 Jérôme Poisson (goffi@goffi.org) # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by @@ -510,11 +509,16 @@ def onAckTimeOut(self, client): """Called when a requested ACK has not been received in time""" log.info(_("Ack was not received in time, aborting connection")) - transport = client.xmlstream.transport - if transport is None: - log.warning("transport was already removed") + try: + xmlstream = client.xmlstream + except AttributeError: + log.warning("xmlstream has already been terminated") else: - transport.abortConnection() + transport = xmlstream.transport + if transport is None: + log.warning("transport was already removed") + else: + transport.abortConnection() client._xep_0198_session.req_timer = None