Merge pull request #274 from anton-ryzhov/fixes
Examples and thread counting
This commit is contained in:
commit
d002d4c06f
@ -151,7 +151,7 @@ if __name__ == '__main__':
|
|||||||
#
|
#
|
||||||
# if xmpp.connect(('talk.google.com', 5222)):
|
# if xmpp.connect(('talk.google.com', 5222)):
|
||||||
# ...
|
# ...
|
||||||
xmpp.process(block=False)
|
xmpp.process(block=True)
|
||||||
print("Done")
|
print("Done")
|
||||||
else:
|
else:
|
||||||
print("Unable to connect.")
|
print("Unable to connect.")
|
||||||
|
@ -37,7 +37,7 @@ class PingTest(sleekxmpp.ClientXMPP):
|
|||||||
def __init__(self, jid, password, pingjid):
|
def __init__(self, jid, password, pingjid):
|
||||||
sleekxmpp.ClientXMPP.__init__(self, jid, password)
|
sleekxmpp.ClientXMPP.__init__(self, jid, password)
|
||||||
if pingjid is None:
|
if pingjid is None:
|
||||||
pingjid = self.jid
|
pingjid = self.boundjid.bare
|
||||||
self.pingjid = pingjid
|
self.pingjid = pingjid
|
||||||
|
|
||||||
# The session_start event will be triggered when
|
# The session_start event will be triggered when
|
||||||
|
@ -1343,12 +1343,12 @@ class XMLStream(object):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def _start_thread(self, name, target, track=True):
|
def _start_thread(self, name, target, track=True):
|
||||||
self.__active_threads.add(name)
|
|
||||||
self.__thread[name] = threading.Thread(name=name, target=target)
|
self.__thread[name] = threading.Thread(name=name, target=target)
|
||||||
self.__thread[name].daemon = self._use_daemons
|
self.__thread[name].daemon = self._use_daemons
|
||||||
self.__thread[name].start()
|
self.__thread[name].start()
|
||||||
|
|
||||||
if track:
|
if track:
|
||||||
|
self.__active_threads.add(name)
|
||||||
with self.__thread_cond:
|
with self.__thread_cond:
|
||||||
self.__thread_count += 1
|
self.__thread_count += 1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user