simply a little webRTC error handling, add more messages
This commit is contained in:
parent
c5aa3372d2
commit
521dd3efe5
6 changed files with 57 additions and 39 deletions
|
|
@ -161,6 +161,7 @@ Wallet.prototype._handleData = function(senderId, data, isInbound) {
|
|||
Wallet.prototype._handleConnect = function(newCopayerId) {
|
||||
if (newCopayerId) {
|
||||
this.log('#### Setting new COPAYER:', newCopayerId);
|
||||
this.currentDelay = this.reconnectDelay;
|
||||
this.sendWalletId(newCopayerId);
|
||||
}
|
||||
var peerID = this.network.peerFromCopayer(newCopayerId)
|
||||
|
|
@ -232,18 +233,11 @@ Wallet.prototype.netStart = function() {
|
|||
net.on('connect', self._handleConnect.bind(self));
|
||||
net.on('disconnect', self._handleDisconnect.bind(self));
|
||||
net.on('data', self._handleData.bind(self));
|
||||
net.on('openError', function() {
|
||||
self.log('[Wallet.js.132:openError:] GOT openError'); //TODO
|
||||
self.emit('openError');
|
||||
});
|
||||
net.on('error', function() {
|
||||
self.emit('connectionError');
|
||||
});
|
||||
net.on('close', function() {
|
||||
self.emit('close');
|
||||
});
|
||||
net.on('serverError', function() {
|
||||
self.emit('serverError');
|
||||
net.on('serverError', function(msg) {
|
||||
self.emit('serverError', msg);
|
||||
});
|
||||
|
||||
var myId = self.getMyCopayerId();
|
||||
|
|
@ -271,9 +265,12 @@ Wallet.prototype.netStart = function() {
|
|||
|
||||
Wallet.prototype.scheduleConnect = function() {
|
||||
var self = this;
|
||||
self.currentDelay = self.currentDelay || self.reconnectDelay;
|
||||
|
||||
if (self.network.isOnline()) {
|
||||
self.connectToAll();
|
||||
setTimeout(self.scheduleConnect.bind(self), self.reconnectDelay);
|
||||
self.currentDelay *=2;
|
||||
setTimeout(self.scheduleConnect.bind(self), self.currentDelay);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue