85,12 → 85,12 |
output = output + '<h2>Subscribers</h2>' |
|
found_subs = 0 |
for x in g_subscribed[:]: |
if int(time.time()) > x[2]: |
g_subscribed.remove(x) |
for subscriber in g_subscribed[:]: |
if int(time.time()) > subscriber[2]: |
g_subscribed.remove(subscriber) |
else: |
found_subs = found_subs + 1 |
output = output + "<p>{0}:{1}</p>".format(x[0], x[1]) |
output = output + "<p>{0}:{1}</p>".format(subscriber[0], subscriber[1]) |
|
if found_subs == 0: |
output = output + '<p>None</p>' |
138,11 → 138,11 |
print "Client subscribed: {0}:{1}, searching for targets {2}".format(client_ip, client_port, client_targets) |
|
# Remove all expired entries, and previous entries of that client |
for x in g_subscribed[:]: |
if int(time.time()) > x[2]: |
g_subscribed.remove(x) |
elif (x[0] == client_ip) and (x[1] == client_port) and (x[3] == client_targets): |
g_subscribed.remove(x) |
for subscriber in g_subscribed[:]: |
if int(time.time()) > subscriber[2]: |
g_subscribed.remove(subscriber) |
elif (subscriber[0] == client_ip) and (subscriber[1] == client_port) and (subscriber[3] == client_targets): |
g_subscribed.remove(subscriber) |
|
# Now add our new client |
g_subscribed.append([client_ip, client_port, client_expires, client_targets]) |
159,11 → 159,15 |
|
found_g = 0 |
|
for subscriber in g_subscribed: |
for subscriber in g_subscribed[:]: |
client_ip = subscriber[0] |
client_port = subscriber[1] |
client_expires = subscriber[2] |
client_targets = subscriber[3] |
|
if int(time.time()) > client_expires: |
g_subscribed.remove(subscriber) |
else: |
found_c = 0 |
for st in server_targets: |
for ct in client_targets: |