Testing zmq PUB/SUB for objects. Enabled by --msg-queue arg.
This commit is contained in:
parent
ddf07fd506
commit
3c56afc570
|
@ -405,6 +405,9 @@ class Connection(threading.Thread):
|
||||||
logging.debug(dest)
|
logging.debug(dest)
|
||||||
shared.i2p_unchecked_node_pool.add((dest, 'i2p'))
|
shared.i2p_unchecked_node_pool.add((dest, 'i2p'))
|
||||||
shared.vector_advertise_queue.put(obj.vector)
|
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':
|
elif m.command == b'getdata':
|
||||||
getdata = message.GetData.from_message(m)
|
getdata = message.GetData.from_message(m)
|
||||||
|
|
|
@ -42,6 +42,8 @@ def parse_arguments():
|
||||||
'--trusted-peer', help='Specify a trusted peer we should connect to')
|
'--trusted-peer', help='Specify a trusted peer we should connect to')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--connection-limit', type=int, help='Maximum number of connections')
|
'--connection-limit', type=int, help='Maximum number of connections')
|
||||||
|
parser.add_argument(
|
||||||
|
'--msg-queue', action='store_true', help='Enable messages queue')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--i2p', action='store_true', help='Enable I2P support (uses SAMv3)')
|
'--i2p', action='store_true', help='Enable I2P support (uses SAMv3)')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
@ -90,6 +92,11 @@ def parse_arguments():
|
||||||
shared.trusted_peer = (addr[0], int(addr[1]))
|
shared.trusted_peer = (addr[0], int(addr[1]))
|
||||||
if args.connection_limit:
|
if args.connection_limit:
|
||||||
shared.connection_limit = 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:
|
if args.i2p:
|
||||||
shared.i2p_enabled = True
|
shared.i2p_enabled = True
|
||||||
if args.i2p_tunnel_length:
|
if args.i2p_tunnel_length:
|
||||||
|
|
|
@ -64,3 +64,5 @@ connection_limit = 250
|
||||||
|
|
||||||
objects = {}
|
objects = {}
|
||||||
objects_lock = threading.Lock()
|
objects_lock = threading.Lock()
|
||||||
|
|
||||||
|
zmq_socket = None
|
||||||
|
|
Loading…
Reference in New Issue
Block a user