Fix race condition
This commit is contained in:
parent
48dc8c78b4
commit
78ff55e34e
2 changed files with 6 additions and 5 deletions
|
@ -858,6 +858,7 @@ define([
|
||||||
});
|
});
|
||||||
|
|
||||||
postMessage = function (cmd, data, cb) {
|
postMessage = function (cmd, data, cb) {
|
||||||
|
cb = cb || function () {}
|
||||||
chan.query(cmd, data, function (err, data) {
|
chan.query(cmd, data, function (err, data) {
|
||||||
if (err) { return void cb ({error: err}); }
|
if (err) { return void cb ({error: err}); }
|
||||||
cb(data);
|
cb(data);
|
||||||
|
|
|
@ -981,6 +981,11 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isNew && channel.wc) {
|
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) {
|
channel.wc.members.forEach(function (m) {
|
||||||
postMessage(clientId, "PAD_JOIN", m);
|
postMessage(clientId, "PAD_JOIN", m);
|
||||||
});
|
});
|
||||||
|
@ -992,11 +997,6 @@ define([
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
postMessage(clientId, "PAD_READY");
|
postMessage(clientId, "PAD_READY");
|
||||||
cb({
|
|
||||||
myID: channel.wc.myID,
|
|
||||||
id: channel.wc.id,
|
|
||||||
members: channel.wc.members
|
|
||||||
});
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue