unify unique id

This commit is contained in:
tknew2 2014-05-14 14:57:06 +02:00
parent 0f693c69ed
commit 0d92abb61f
2 changed files with 5 additions and 1 deletions

View File

@ -23,7 +23,7 @@ function generateId() {
var crypto = require('crypto');
var os = require('os');
var parts = [os.hostname(), process.pid, +(new Date)];
var parts = [os.hostname(), JSON.stringify(os.networkInterfaces)];
var hash = crypto.createHash('md5').update(parts.join(''));
return hash.digest('hex');
}

View File

@ -4,6 +4,10 @@ var WatchDog = require('../lib/WatchDog.js');
var fs = require('fs');
var cst = require('../constants.js');
if (fs.existsSync(cst.WATCHDOG_FILE)) {
process.exit(0);
}
(function pre_init() {
fs.exists(cst.DEFAULT_FILE_PATH, function(exist) {
if (!exist) {