mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-24 03:00:15 +00:00
added module config for number of threads
This commit is contained in:
parent
436841fa6f
commit
32ef496502
1 changed files with 6 additions and 3 deletions
|
@ -12,6 +12,8 @@ import traceback
|
||||||
import types
|
import types
|
||||||
import xml.sax.saxutils
|
import xml.sax.saxutils
|
||||||
|
|
||||||
|
HANDLER_THREADS = 1
|
||||||
|
|
||||||
ssl_support = True
|
ssl_support = True
|
||||||
try:
|
try:
|
||||||
import ssl
|
import ssl
|
||||||
|
@ -118,8 +120,9 @@ class XMLStream(object):
|
||||||
raise RestartStream()
|
raise RestartStream()
|
||||||
|
|
||||||
def process(self, threaded=True):
|
def process(self, threaded=True):
|
||||||
self.__thread['eventhandle'] = threading.Thread(name='eventhandle', target=self._eventRunner)
|
for t in range(0, HANDLER_THREADS):
|
||||||
self.__thread['eventhandle'].start()
|
self.__thread['eventhandle%s' % t] = threading.Thread(name='eventhandle%s' % t, target=self._eventRunner)
|
||||||
|
self.__thread['eventhandle%s' % t].start()
|
||||||
if threaded:
|
if threaded:
|
||||||
self.__thread['process'] = threading.Thread(name='process', target=self._process)
|
self.__thread['process'] = threading.Thread(name='process', target=self._process)
|
||||||
self.__thread['process'].start()
|
self.__thread['process'].start()
|
||||||
|
@ -269,7 +272,7 @@ class XMLStream(object):
|
||||||
try:
|
try:
|
||||||
event = self.eventqueue.get(True, timeout=5)
|
event = self.eventqueue.get(True, timeout=5)
|
||||||
except queue.Empty:
|
except queue.Empty:
|
||||||
even = None
|
event = None
|
||||||
if event is not None:
|
if event is not None:
|
||||||
etype, handler, stanza = event
|
etype, handler, stanza = event
|
||||||
if etype == 'stanza':
|
if etype == 'stanza':
|
||||||
|
|
Loading…
Reference in a new issue