# HG changeset patch # User Goffi # Date 1580246772 -3600 # Node ID 87b8808ac49d513a408eef0c29061eb763fd2e67 # Parent b64dd7c1496dcadfda278ac1da1739b0f4c72661 plugin XEP-0198: don't crash when xmlstream has been closed diff -r b64dd7c1496d -r 87b8808ac49d sat/plugins/plugin_xep_0198.py --- 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