沈斌
2017-08-11 f734dac419a81e19eaa5eda81f78b8c215498e0d
rollback
1 files modified
28 ■■■■ changed files
server.js 28 ●●●● patch | view | raw | blame | history
server.js
@@ -113,8 +113,13 @@
    }
}
mongoClient.connect(config.URL, function(err, db) {
    if (err) {
        console.log(err.message);
        return;
    }
    console.log('Connecting to Mongo DB at ' + config.URL);
function doTCPSocket(db) {
    //初始化三级警报通讯方式
    method.initConfigs(db);
@@ -158,23 +163,4 @@
    }).listen(config.PORT, config.HOST);
    console.log('TCP Server listening on ' + config.HOST + ':' + config.PORT);
}
var db;
if(db == null) {
    mongoClient.connect(config.URL, function(err, database) {
        if (err) {
            console.log(err.message);
            return;
        }
        console.log('Connecting to Mongo DB at ' + config.URL);
        db = database;
        doTCPSocket(db);
    });
} else {
    console.log('==========*****==========');
    doTCPSocket(db);
}
});