diff --git a/minode/connection.py b/minode/connection.py index 8c921a3..2f01742 100644 --- a/minode/connection.py +++ b/minode/connection.py @@ -405,6 +405,9 @@ class Connection(threading.Thread): logging.debug(dest) shared.i2p_unchecked_node_pool.add((dest, 'i2p')) shared.vector_advertise_queue.put(obj.vector) + if shared.zmq_socket: + shared.zmq_socket.send( + b'obj\x00%i\x00' % obj.object_type + obj.to_bytes()) elif m.command == b'getdata': getdata = message.GetData.from_message(m) diff --git a/minode/main.py b/minode/main.py index 9100206..aae3c46 100644 --- a/minode/main.py +++ b/minode/main.py @@ -42,6 +42,8 @@ def parse_arguments(): '--trusted-peer', help='Specify a trusted peer we should connect to') parser.add_argument( '--connection-limit', type=int, help='Maximum number of connections') + parser.add_argument( + '--msg-queue', action='store_true', help='Enable messages queue') parser.add_argument( '--i2p', action='store_true', help='Enable I2P support (uses SAMv3)') parser.add_argument( @@ -90,6 +92,11 @@ def parse_arguments(): shared.trusted_peer = (addr[0], int(addr[1])) if args.connection_limit: shared.connection_limit = args.connection_limit + if args.msg_queue: + import zmq + zmq_context = zmq.Context() + shared.zmq_socket = zmq_context.socket(zmq.PUB) + shared.zmq_socket.bind("tcp://*:5556") if args.i2p: shared.i2p_enabled = True if args.i2p_tunnel_length: diff --git a/minode/shared.py b/minode/shared.py index d49786c..ce0c613 100644 --- a/minode/shared.py +++ b/minode/shared.py @@ -64,3 +64,5 @@ connection_limit = 250 objects = {} objects_lock = threading.Lock() + +zmq_socket = None