This commit is contained in:
End 2020-08-09 14:38:41 +02:00
parent c1888e1cc3
commit fa9fa1746c
3 changed files with 12 additions and 8 deletions

View file

@ -2,12 +2,12 @@
import pdb
from mitmproxy import ctx
import threading
from queue import Queue
from queue import Queue, Empty
import time
import zmq
import json
NO_MSG {"msg": None}
NO_MSG = {"msg": None}
INIT_MSG = {"msg": "init"}
ACK_MSG = {"msg": "ack"}
PING_MSG = {"msg": "ping"}
@ -30,7 +30,7 @@ def get_msg(socket):
if msg:
return json.loads(msg)
except json.JSONDecodeError:
print("malformed message received '{msg}'")
print(f"malformed message received {msg}")
return NO_MSG
@ -68,7 +68,10 @@ def networking(q):
timer = time.monotonic()
if not a:
a = q.get(block=False)
try:
a = q.get(block=False)
except Empty:
pass
if a:
send_msg(a, socket)
msg = get_msg(socket)