switch to classic API
This commit is contained in:
		| @@ -7,9 +7,8 @@ import sys | ||||
| import threading | ||||
|  | ||||
| import zmq | ||||
| from zmq.asyncio import Context | ||||
| import zmq.auth | ||||
| from zmq.auth.asyncio import AsyncioAuthenticator | ||||
| from zmq.auth import Authenticator | ||||
|  | ||||
| from aman.config import Server | ||||
|  | ||||
| @@ -20,8 +19,15 @@ class ReceiverThread(threading.Thread): | ||||
|  | ||||
|     def run(self): | ||||
|         try: | ||||
|             # create the poller to wait with a timeout to receive data | ||||
|             poller = zmq.Poller() | ||||
|             poller.register(self.socket, zmq.POLLIN) | ||||
|  | ||||
|             while True: | ||||
|                 True | ||||
|                 # wait 1s to receive data | ||||
|                 events = poller.poll(1000) | ||||
|                 if self.socket in events and events[self.socket] == zmq.POLLIN: | ||||
|                     msg = self.socket.recv() | ||||
|         finally: | ||||
|             return | ||||
|  | ||||
| @@ -43,13 +49,13 @@ class Euroscope: | ||||
|     # @brief Initializes the ZMQ socket | ||||
|     # @param[in] config The server configuration | ||||
|     def __init__(self, config : Server.Server): | ||||
|         self.context = Context.instance() | ||||
|         self.context = zmq.Context() | ||||
|  | ||||
|         # initialize the authentication module | ||||
|         authLocation = ( | ||||
|             str(config.ClientKeyPath) | ||||
|         ) | ||||
|         self.auth = AsyncioAuthenticator(context = self.context) | ||||
|         self.auth = Authenticator(context = self.context) | ||||
|         self.auth.configure_curve(domain='*', location = authLocation) | ||||
|         self.auth.allow('127.0.0.1') | ||||
|         self.auth.start() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user