fixes handling networking errors and retries. Adds tests
This commit is contained in:
parent
50a29909ba
commit
bbac45ee7a
3 changed files with 117 additions and 35 deletions
|
|
@ -223,17 +223,24 @@ WalletFactory.prototype.joinCreateSession = function(secret, nickname, passphras
|
|||
key: privateKey.getIdKey()
|
||||
};
|
||||
self.network.cleanUp();
|
||||
|
||||
// This is a hack to reconize if the connection was rejected or the peer wasn't there.
|
||||
var connectedOnce = false;
|
||||
self.network.on('connected', function(sender, data) {
|
||||
connectedOnce = true;
|
||||
});
|
||||
self.network.on('onlyYou', function(sender, data) {
|
||||
return cb(connectedOnce ? 'walletFull' : 'joinError');
|
||||
});
|
||||
|
||||
self.network.on('serverError', function() {
|
||||
console.log('[WalletFactory.js.236]'); //TODO
|
||||
return cb('joinError');
|
||||
});
|
||||
|
||||
self.network.start(opts, function() {
|
||||
self.network.connectTo(s.pubKey);
|
||||
|
||||
// This is a hack to reconize if the connection was rejected or the peer wasn't there.
|
||||
var connectedOnce = false;
|
||||
self.network.on('connected', function(sender, data) {
|
||||
connectedOnce = true;
|
||||
});
|
||||
self.network.on('onlyYou', function(sender, data) {
|
||||
return cb(connectedOnce ? 'walletFull' : 'joinError');
|
||||
});
|
||||
self.network.on('data', function(sender, data) {
|
||||
if (data.type === 'walletId') {
|
||||
if (data.networkName !== self.networkName) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue