mirror of https://github.com/BTCPrivate/copay.git
work towards connection error
This commit is contained in:
parent
c65e677f2c
commit
7b2f227bcc
|
@ -63,9 +63,7 @@ Wallet.prototype.seedCopayer = function(pubKey) {
|
||||||
|
|
||||||
Wallet.prototype.connectToAll = function() {
|
Wallet.prototype.connectToAll = function() {
|
||||||
|
|
||||||
console.log('[Wallet.js.57]'); //TODO
|
|
||||||
var all = this.publicKeyRing.getAllCopayerIds();
|
var all = this.publicKeyRing.getAllCopayerIds();
|
||||||
|
|
||||||
console.log('[Wallet.js.58] connecting'); //TODO
|
console.log('[Wallet.js.58] connecting'); //TODO
|
||||||
this.network.connectToCopayers(all);
|
this.network.connectToCopayers(all);
|
||||||
if (this.seededCopayerId) {
|
if (this.seededCopayerId) {
|
||||||
|
@ -224,8 +222,8 @@ Wallet.prototype.netStart = function() {
|
||||||
self.log('[Wallet.js.132:openError:] GOT openError'); //TODO
|
self.log('[Wallet.js.132:openError:] GOT openError'); //TODO
|
||||||
self.emit('openError');
|
self.emit('openError');
|
||||||
});
|
});
|
||||||
net.on('error', function(){
|
net.on('error', function() {
|
||||||
self.emit('connectionError'); // Bubble the error
|
self.emit('connectionError');
|
||||||
});
|
});
|
||||||
net.on('close', function() {
|
net.on('close', function() {
|
||||||
self.emit('close');
|
self.emit('close');
|
||||||
|
|
|
@ -269,7 +269,6 @@ Network.prototype._setupPeerHandlers = function(openCallback) {
|
||||||
self._checkAnyPeer();
|
self._checkAnyPeer();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
p.on('connection', function(dataConn) {
|
p.on('connection', function(dataConn) {
|
||||||
console.log('### NEW INBOUND CONNECTION %d/%d', self.connectedPeers.length, self.maxPeers);
|
console.log('### NEW INBOUND CONNECTION %d/%d', self.connectedPeers.length, self.maxPeers);
|
||||||
if (self.connectedPeers.length >= self.maxPeers) {
|
if (self.connectedPeers.length >= self.maxPeers) {
|
||||||
|
|
|
@ -62,35 +62,29 @@ angular.module('copay.controllerUtils')
|
||||||
$rootScope.wallet = w;
|
$rootScope.wallet = w;
|
||||||
$location.path('addresses');
|
$location.path('addresses');
|
||||||
video.setOwnPeer(myPeerID, w, handlePeerVideo);
|
video.setOwnPeer(myPeerID, w, handlePeerVideo);
|
||||||
console.log('# Done ready handler');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
w.on('publicKeyRingUpdated', function(dontDigest) {
|
w.on('publicKeyRingUpdated', function(dontDigest) {
|
||||||
console.log('[start publicKeyRing handler]'); //TODO
|
|
||||||
root.setSocketHandlers();
|
root.setSocketHandlers();
|
||||||
root.updateAddressList();
|
root.updateAddressList();
|
||||||
if (!dontDigest) {
|
if (!dontDigest) {
|
||||||
console.log('[pkr digest]');
|
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
console.log('[done digest]');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
w.on('txProposalsUpdated', function(dontDigest) {
|
w.on('txProposalsUpdated', function(dontDigest) {
|
||||||
root.updateTxs({onlyPending:true});
|
root.updateTxs({onlyPending:true});
|
||||||
root.updateBalance(function(){
|
root.updateBalance(function(){
|
||||||
if (!dontDigest) {
|
if (!dontDigest) {
|
||||||
console.log('[txp digest]');
|
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
console.log('[done digest]');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
w.on('openError', root.onErrorDigest);
|
w.on('openError', root.onErrorDigest);
|
||||||
|
w.on('connectionError', root.onErrorDigest);
|
||||||
w.on('connect', function(peerID) {
|
w.on('connect', function(peerID) {
|
||||||
if (peerID) {
|
if (peerID) {
|
||||||
video.callPeer(peerID, handlePeerVideo);
|
video.callPeer(peerID, handlePeerVideo);
|
||||||
}
|
}
|
||||||
console.log('[digest]');
|
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
});
|
});
|
||||||
w.on('disconnect', function(peerID) {
|
w.on('disconnect', function(peerID) {
|
||||||
|
@ -129,7 +123,6 @@ angular.module('copay.controllerUtils')
|
||||||
$rootScope.availableBalance = safeBalance;
|
$rootScope.availableBalance = safeBalance;
|
||||||
root.updateAddressList();
|
root.updateAddressList();
|
||||||
$rootScope.updatingBalance = false;
|
$rootScope.updatingBalance = false;
|
||||||
console.log('Done updating balance.'); //TODO
|
|
||||||
return cb?cb():null;
|
return cb?cb():null;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -145,7 +138,6 @@ angular.module('copay.controllerUtils')
|
||||||
var inT = w.getTxProposals().sort(function(t1, t2) { return t1.createdTs < t2.createdTs });
|
var inT = w.getTxProposals().sort(function(t1, t2) { return t1.createdTs < t2.createdTs });
|
||||||
var txs = [];
|
var txs = [];
|
||||||
|
|
||||||
console.log('[START LOOP]'); //TODO
|
|
||||||
inT.forEach(function(i, index){
|
inT.forEach(function(i, index){
|
||||||
if (opts.skip && (index < opts.skip[0] || index >= opts.skip[1])) {
|
if (opts.skip && (index < opts.skip[0] || index >= opts.skip[1])) {
|
||||||
return txs.push(null);
|
return txs.push(null);
|
||||||
|
|
Loading…
Reference in New Issue