Skip to content

Commit

Permalink
report zmq changes only with stats enabled
Browse files Browse the repository at this point in the history
Probably fixes #122
  • Loading branch information
Sec42 committed Dec 2, 2024
1 parent 91b9e15 commit a9b66c3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions iridium-parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,13 @@ def __call__(self, parser, ns, values, option):

context = zmq.Context()
socket = context.socket(zmq.XPUB)
socket.setsockopt(zmq.XPUB_VERBOSE, True)
if args.do_stats:
socket.setsockopt(zmq.XPUB_VERBOSE, True)
stats['clients']=0
poller = zmq.Poller()
poller.register(socket, zmq.POLLIN)
socket.bind(url)

stats['clients']=0
poller = zmq.Poller()
poller.register(socket, zmq.POLLIN)

def zmq_xpub(poller, stats):
try:
Expand Down Expand Up @@ -283,7 +284,7 @@ def do_input():
stats['files']=len(args.remainder)
stats['fileno']=0
for line in fileinput.input(args.remainder, openhook=openhook):
if args.do_stats or poller is not None:
if args.do_stats:
if fileinput.isfirstline():
stats['fileno']+=1
stat=os.fstat(fileinput.fileno())
Expand Down

0 comments on commit a9b66c3

Please sign in to comment.