Browse Source

Do not crash on join errors.

master
t123yh 7 years ago
parent
commit
617f6afdd8
  1. 10
      src/frontend-syzoj/socketio.ts

10
src/frontend-syzoj/socketio.ts

@ -133,18 +133,18 @@ export function initializeSocketIO(s: http.Server) {
throw new Error("Request type in token mismatch."); throw new Error("Request type in token mismatch.");
} }
clientDisplayConfigList[socket.id] = req.displayConfig; clientDisplayConfigList[socket.id] = req.displayConfig;
const taskId = req.taskId;
winston.verbose(`A client trying to join ${name} namespace for ${taskId}.`);
socket.join(taskId.toString());
exec(req, socket).then(x => cb(x), err => cb({ ok: false, message: err.toString() }));
} catch (err) { } catch (err) {
winston.info('The client has an incorrect token.'); winston.info('Error while joining.');
cb({ cb({
ok: false, ok: false,
message: err.toString() message: err.toString()
}); });
return; return;
} }
const taskId = req.taskId;
winston.verbose(`A client trying to join ${name} namespace for ${taskId}.`);
socket.join(taskId.toString());
exec(req, socket).then(x => cb(x), err => cb({ ok: false, message: err.toString() }));
}); });
}); });
return newNamespace; return newNamespace;

Loading…
Cancel
Save