plugin XEP-0085: fixed bad use of threads resulting in delay and crash when stopping the backend.
This commit is contained in:
parent
9877497dbc
commit
55f98749e1
1 changed files with 3 additions and 6 deletions
|
|
@ -29,8 +29,8 @@ try:
|
|||
from twisted.words.protocols.xmlstream import XMPPHandler
|
||||
except ImportError:
|
||||
from wokkel.subprotocols import XMPPHandler
|
||||
from threading import Timer
|
||||
from twisted.words.xish import domish
|
||||
from twisted.internet import reactor
|
||||
|
||||
NS_XMPP_CLIENT = "jabber:client"
|
||||
NS_CHAT_STATES = "http://jabber.org/protocol/chatstates"
|
||||
|
|
@ -324,7 +324,7 @@ class XEP_0085(object):
|
|||
pass
|
||||
|
||||
|
||||
class ChatStateMachine:
|
||||
class ChatStateMachine(object):
|
||||
"""
|
||||
This class represents a chat state, between one profile and
|
||||
one target contact. A timer is used to move from one state
|
||||
|
|
@ -372,12 +372,9 @@ class ChatStateMachine:
|
|||
client.xmlstream.send(mess_data['xml'])
|
||||
|
||||
self.state = state
|
||||
if self.timer is not None:
|
||||
self.timer.cancel()
|
||||
|
||||
if transition["next_state"] and transition["delay"] > 0:
|
||||
self.timer = Timer(transition["delay"], self._onEvent, [transition["next_state"]])
|
||||
self.timer.start()
|
||||
self.timer = reactor.callLater(transition["delay"], self._onEvent, transition["next_state"])
|
||||
|
||||
|
||||
class XEP_0085_handler(XMPPHandler):
|
||||
|
|
|
|||
Loading…
Reference in a new issue