Browse Source

try catch

master
zeus 3 years ago
parent
commit
912c43a01e
  1. 82
      llo/connect-new.js

82
llo/connect-new.js

@ -1486,6 +1486,7 @@ function mywgRemoveClosedConnection(){
console.log('fount disconnect '+found + ' ' + showexecrm1 )
// auto close when no connection exist
/*
var showexec1 = `docker exec swlabadminvenus /bin/bash -c "${wgdown}"; ${showexecrm1}`
log1 = spawn(showexec1, {
shell: true,
@ -1499,23 +1500,13 @@ function mywgRemoveClosedConnection(){
n.data = code
io.emit('message_close', n);
});
*/
}else{
console.log('fountsearch '+found + ' ' + search )
}
}
})
}
}
} catch (err) {
@ -1535,6 +1526,7 @@ function mywgRemoveClosedConnection(){
var n = {}
n.data = code
io.emit('message_close', n);
//auto close network container
mywgcheckStatus();
});
@ -1543,74 +1535,6 @@ function mywgRemoveClosedConnection(){
console.log('errorhello '+JSON.stringify(n1));
io.emit('message_err', n1);
/*
try {
var mongourl = `mongodb://${mongoserver.mongo_user}:${mongoserver.mongo_pass}@${mongoserver.mongo_ip}:${mongoserver.mongo_port}`;
const OPTS = {
useNewUrlParser: true,
useUnifiedTopology: true
};
MongoClient.connect(mongourl, OPTS, function(err, db) {
if(err){
console.log(err);
} else {
var dbo = db.db(mongoserver.mongo_db);
var limit = 2
dbo.collection(mongoserver.mongo_coll).find({"stackid":bootstrapstackid},{sort:{_id:-1}}).limit(limit).toArray(function(err, result) {
if(err){
console.log(err);
} else {
console.log(JSON.stringify(result));
//if("transferTx" in result[0]){
if(result[0].log[0].peers[respublickey].transferTx && result.length == 2){
if(result[0].log[0].peers[respublickey].transferTx == result[1].log[0].peers[respublickey].transferTx){
console.log(JSON.stringify(result.length));
console.log(JSON.stringify('-------- '+JSON.stringify(result[0].log[0].peers[respublickey].transferTx)));
console.log(JSON.stringify('-------- '+JSON.stringify(result[1].log[0].peers[respublickey].transferTx)));
}
}
db.close();
}
});
}
});
} catch (err) {
console.error(err);
}
try {
var mongourl = `mongodb://${mongoserver.mongo_user}:${mongoserver.mongo_pass}@${mongoserver.mongo_ip}:${mongoserver.mongo_port}`;
const OPTS = {
useNewUrlParser: true,
useUnifiedTopology: true
};
MongoClient.connect(mongourl, OPTS, function(err, db) {
if(err){
console.log(err);
} else {
var dbo = db.db(mongoserver.mongo_db);
var limit = 2
dbo.collection(mongoserver.mongo_coll).find({"stackid":res.bootstrapstackid},{sort:{_id:-1}}).limit(limit).toArray(function(err, result) {
if(err){
console.log(err);
} else {
console.log(JSON.stringify(result));
//if("transferTx" in result[0]){
if(result[0].log[0].peers[res.publickey].transferTx && result.length == 2){
console.log(JSON.stringify(result.length));
console.log(JSON.stringify('-------- '+JSON.stringify(result[0].log[0].peers[res.publickey].transferTx)));
console.log(JSON.stringify('-------- '+JSON.stringify(result[1].log[0].peers[res.publickey].transferTx)));
}
db.close();
}
});
}
});
} catch (err) {
console.error(err);
}
*/
}
mywgRemoveClosedConnection();

Loading…
Cancel
Save