Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/CIRCL/bgp-ranking
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Aug 5, 2014
2 parents 1a7a281 + fe549ae commit a437078
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions lib/modules/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@
import importlib
import sys
from pubsublogger import publisher
try:
import zmq
has_zmq = True
port = "5556"
context = zmq.Context()
socket = context.socket(zmq.PUB)
socket.bind("tcp://*:%s" % port)
except:
has_zmq = False

separator = '|'
key_ip = 'ip'
Expand All @@ -32,6 +23,8 @@

temp_db = None

ip_publisher_channel = 'ips'


def __prepare():
global temp_db
Expand All @@ -54,10 +47,9 @@ def new_entry(ip, source, timestamp):
uid = temp_db.incr(key_uid)
p = temp_db.pipeline()
p.hmset(uid, {key_ip: ip, key_src: source, key_tstamp: timestamp})
p.publish(ip_publisher_channel, '"{}","{}","{}"'.format(source, timestamp, ip))
p.sadd(key_uid_list, uid)
p.execute()
if has_zmq:
socket.send('"{}","{}","{}"'.format(source, timestamp, ip))


def __get_files(directory):
Expand Down

0 comments on commit a437078

Please sign in to comment.