Commit c6e93f8c authored by Maxime Bloch's avatar Maxime Bloch

fix socket message not sending

parent b4fd3f97
......@@ -37,20 +37,20 @@ def start_run(run_index):
return f'Run {run_index} started at {starttime}'
@app.route("/link/start/<run>/<index>")
def link_start(run, index):
request_data = live_request(run, index)
@app.route("/link/start/<run>/<link_index>")
def link_start(run, link_index):
request_data = live_request(run, link_index)
sio.emit('live_request', request_data)
if db["current_run"] != run:
return "Wrong run number, check that you update your run", 404
else:
run_data = db["run_data"][run]["data"]
if index in run_data:
if link_index in run_data:
return "you already started in this run. Ignoring this request."
else:
run_data[index] = {"id": index, "start": time()}
sio.emit('link_start', run_data[index])
run_data[link_index] = {"id": link_index, "start": time()}
sio.emit('link_start', run_data[link_index])
return "Success."
......@@ -78,7 +78,7 @@ def connect(sid, data):
def live_request(run, index):
ip = request.remote_addr
request_data = {}
request_data["hostname"] = socket.gethostbyaddr(ip)
request_data["hostname"] = socket.gethostbyaddr(ip)[0]
request_data["time"] = time()
return request_data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment