Fix race condition

This commit is contained in:
yflory 2018-06-06 18:21:52 +02:00
parent 48dc8c78b4
commit 78ff55e34e
2 changed files with 6 additions and 5 deletions

View file

@ -858,6 +858,7 @@ define([
});
postMessage = function (cmd, data, cb) {
cb = cb || function () {}
chan.query(cmd, data, function (err, data) {
if (err) { return void cb ({error: err}); }
cb(data);

View file

@ -981,6 +981,11 @@ define([
}
if (!isNew && channel.wc) {
postMessage(clientId, "PAD_CONNECT", {
myID: channel.wc.myID,
id: channel.wc.id,
members: channel.wc.members
});
channel.wc.members.forEach(function (m) {
postMessage(clientId, "PAD_JOIN", m);
});
@ -992,11 +997,6 @@ define([
});
});
postMessage(clientId, "PAD_READY");
cb({
myID: channel.wc.myID,
id: channel.wc.id,
members: channel.wc.members
});
return;
}