From c6e93f8c7fc3633b15edf2afc8ab9455aa94ce42 Mon Sep 17 00:00:00 2001 From: Maxime Bloch Date: Fri, 27 Sep 2019 17:43:33 +0200 Subject: [PATCH] fix socket message not sending --- watcher/app.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/watcher/app.py b/watcher/app.py index 435795f..93d3625 100644 --- a/watcher/app.py +++ b/watcher/app.py @@ -37,20 +37,20 @@ def start_run(run_index): return f'Run {run_index} started at {starttime}' -@app.route("/link/start//") -def link_start(run, index): - request_data = live_request(run, index) +@app.route("/link/start//") +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