Commit de1bbd93 authored by Philip ABBET's avatar Philip ABBET

Remove usage of gevent

parent bab77a41
......@@ -29,20 +29,16 @@
import logging
logger = logging.getLogger(__name__)
import gevent
import zmq.green as zmq
import zmq
import simplejson
import requests
from gevent import monkey
monkey.patch_socket(dns=False)
monkey.patch_ssl()
import threading
from . import baseformat
from .inputs import RemoteException
class MessageHandler(gevent.Greenlet):
class MessageHandler(threading.Thread):
'''A 0MQ message handler for our communication with other processes
Support for more messages can be implemented by subclassing this class.
......@@ -54,10 +50,10 @@ class MessageHandler(gevent.Greenlet):
super(MessageHandler, self).__init__()
# An event unblocking a graceful stop
self.stop = gevent.event.Event()
self.stop = threading.Event()
self.stop.clear()
self.must_kill = gevent.event.Event()
self.must_kill = threading.Event()
self.must_kill.clear()
# Starts our 0MQ server
......@@ -85,7 +81,7 @@ class MessageHandler(gevent.Greenlet):
)
def _run(self):
def run(self):
logger.debug("0MQ server thread started")
......@@ -95,6 +91,7 @@ class MessageHandler(gevent.Greenlet):
if self.kill_callback is not None:
self.kill_callback()
self.must_kill.clear()
break
timeout = 1000 #ms
socks = dict(self.poller.poll(timeout)) #yields to the next greenlet
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment