Skip to content
This repository was archived by the owner on Sep 25, 2023. It is now read-only.

fix bug: "Error: Not running" when stop server #647

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
1.1.9 / 2015-06-05
=================
* [NEW] upgrade pomelo-rpc to 0.4.10
* [NEW] upgrade pomelo-admin to 0.4.4
* [NEW] upgrade pomelo-logger to 0.1.7

1.1.8 / 2015-05-29
=================
* fix bug on verison calculating when update proto files
* avoid modules loading error on windows
* [NEW] upgrade pomelo-protocol to 0.1.6

1.1.7 / 2015-05-12
=================
* [#706](https://github.com/NetEase/pomelo/pull/706)
* [#707](https://github.com/NetEase/pomelo/pull/707)
* [#443](https://github.com/NetEase/pomelo/pull/443)
* [#444](https://github.com/NetEase/pomelo/pull/444)
* [#713](https://github.com/NetEase/pomelo/pull/713)
* [NEW] upgrade pomelo-rpc to 0.4.9
* [NEW] upgrade pomelo-admin to 0.4.3

1.1.6 / 2015-03-12
=================
* [NEW] add configure file automatically reload feature
Expand Down
10 changes: 6 additions & 4 deletions lib/components/protobuf.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ var Component = function(app, opts) {
var originClientPath = path.join(app.getBase(), Constants.FILEPATH.CLIENT_PROTOS);
var presentClientPath = path.join(Constants.FILEPATH.CONFIG_DIR, env, path.basename(Constants.FILEPATH.CLIENT_PROTOS));

this.serverProtosPath = opts.serverProtos || (fs.existsSync(originClientPath) ? Constants.FILEPATH.SERVER_PROTOS : presentServerPath);
this.clientProtosPath = opts.clientProtos || (fs.existsSync(originServerPath) ? Constants.FILEPATH.CLIENT_PROTOS : presentClientPath);
this.serverProtosPath = opts.serverProtos || (fs.existsSync(originServerPath) ? Constants.FILEPATH.SERVER_PROTOS : presentServerPath);
this.clientProtosPath = opts.clientProtos || (fs.existsSync(originClientPath) ? Constants.FILEPATH.CLIENT_PROTOS : presentClientPath);

this.setProtos(Constants.RESERVED.SERVER, path.join(app.getBase(), this.serverProtosPath));
this.setProtos(Constants.RESERVED.CLIENT, path.join(app.getBase(), this.clientProtosPath));
Expand Down Expand Up @@ -88,6 +88,7 @@ pro.onUpdate = function(type, path, event) {
if(event !== 'change') {
return;
}

var self = this;
fs.readFile(path, 'utf8' ,function(err, data) {
try {
Expand All @@ -100,8 +101,9 @@ pro.onUpdate = function(type, path, event) {
self.clientProtos = protos;
}

self.version = fs.statSync(path).mtime.getTime();
logger.debug('change proto file , type : %j, path : %j, version : %j', type, path, this.version);
var protoStr = JSON.stringify(self.clientProtos) + JSON.stringify(self.serverProtos);
self.version = crypto.createHash('md5').update(protoStr).digest('base64');
logger.info('change proto file , type : %j, path : %j, version : %j', type, path, self.version);
} catch(e) {
logger.warn("change proto file error! path : %j", path);
logger.warn(e);
Expand Down
8 changes: 7 additions & 1 deletion lib/modules/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,13 @@ var checkPort = function(server, cb) {

var p = server.port || server.clientPort;
var host = server.host;
var cmd = 'netstat -tln | grep ';
var cmd;
var os = require('os');
if (os.platform() == Constants.PLATFORM.WIN) {
cmd = 'netstat -ano | findstr /I ';
} else {
cmd = 'netstat -tln | grep '; // unix-like os, linux
}
if (!utils.isLocal(host)) {
cmd = 'ssh ' + host + ' ' + cmd;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/pomelo.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
var fs = require('fs');
var path = require('path');
var application = require('./application');

var Package = require('../package');

/**
* Expose `createApplication()`.
Expand All @@ -24,7 +24,7 @@ var Pomelo = module.exports = {};
* Framework version.
*/

Pomelo.version = '1.1.6';
Pomelo.version = Package.version;

/**
* Event definitions that would be emitted by app.event
Expand Down
8 changes: 5 additions & 3 deletions lib/util/moduleUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ pro.registerDefaultModules = function(isMaster, app, closeWatcher) {
app.registerAdmin(admin.modules.watchServer,{app:app});
app.registerAdmin(require('../modules/console'), {app: app, starter: starter});
if(app.enabled('systemMonitor')) {
app.registerAdmin(admin.modules.systemInfo);
app.registerAdmin(admin.modules.nodeInfo);
if(os.platform() !== Constants.PLATFORM.WIN) {
app.registerAdmin(admin.modules.systemInfo);
app.registerAdmin(admin.modules.nodeInfo);
}
app.registerAdmin(admin.modules.monitorLog, {path: pathUtil.getLogPath(app.getBase())});
app.registerAdmin(admin.modules.scripts, {app:app, path: pathUtil.getScriptPath(app.getBase())});
if(os.platform() !== Constants.PLATFORM.WIN) {
Expand All @@ -91,4 +93,4 @@ var startModule = function(err, modules, index, cb) {
} else {
startModule(err, modules, index + 1, cb);
}
};
};
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pomelo",
"version": "1.1.6",
"version": "1.1.9",
"private": false,
"homepage": "https://github.com/NetEase/pomelo",
"repository": {
Expand Down Expand Up @@ -35,10 +35,10 @@
"cliff": "0.1.8",
"mkdirp": "0.3.3",
"pomelo-loader": "0.0.6",
"pomelo-rpc": "0.4.8",
"pomelo-protocol": "0.1.4",
"pomelo-admin": "0.4.2",
"pomelo-logger": "0.1.6",
"pomelo-rpc": "0.4.10",
"pomelo-protocol": "0.1.6",
"pomelo-admin": "0.4.4",
"pomelo-logger": "0.1.7",
"pomelo-scheduler": "0.3.9",
"ws": "0.4.25",
"pomelo-protobuf": "0.4.0",
Expand Down