From 6017a45e355a9c3b61c970312ad07819728f2e1c Mon Sep 17 00:00:00 2001 From: Piyush Mishra Date: Mon, 22 Feb 2021 11:37:50 +0530 Subject: [PATCH] minor fix --- src/ws_sansad.rs | 5 +++-- static/js/app.js | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/ws_sansad.rs b/src/ws_sansad.rs index 4365d03..51b6c35 100644 --- a/src/ws_sansad.rs +++ b/src/ws_sansad.rs @@ -182,8 +182,8 @@ impl WsSansad { // heartbeat timed out // stop actor - ctx.stop(); - + futures::executor::block_on(act.leave_grih()); // notify leaving + ctx.stop(); // don't try to send a ping return; } @@ -202,6 +202,7 @@ impl WsSansad { // heartbeat timed out // stop actor + futures::executor::block_on(act.leave_grih()); // notify leaving ctx.stop(); // don't try to send a ping diff --git a/static/js/app.js b/static/js/app.js index 5baa68d..9c3c17d 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -177,7 +177,10 @@ function connect(frm) { $('#progressbar').removeClass('hidden'); var data = {}; frm.serializeArray().forEach(el => { - data[el.name] = el.value; + if(typeof el.value == 'string') + data[el.name] = el.value.trim(); + else + data[el.name] = el.value; }); if(data['length'] !== undefined) { data['length'] = parseInt(data['length']); @@ -222,7 +225,10 @@ function connect_next() { socket.send(JSON.stringify({ cmd: 'randnext' })); } +var leaving = false; function leave() { + if(leaving) return; + leaving = true; callbacks = []; callbacks.push(() => { $('#progressbar').addClass('hidden'); @@ -234,6 +240,7 @@ function leave() { myinfo.kunjika = ''; myinfo.name = ''; joining = false; + leaving = false; }); socket.send(JSON.stringify({ cmd: 'leave'