bugfix for #36, ready to release v3.7.7

This commit is contained in:
OttoMao 2015-10-02 14:06:18 +08:00
parent a0c8862be9
commit 31daeebdd5
5 changed files with 18 additions and 13 deletions

View File

@ -1,3 +1,7 @@
2 Oct: AnyProxy 3.7.7:
* bugfix for proxy.close() ref #36
9 Sep: AnyProxy 3.7.6: 9 Sep: AnyProxy 3.7.6:
* optimize detail panel, ref #35 * optimize detail panel, ref #35

View File

@ -8,7 +8,6 @@ function printLog(content,type){
if(!ifPrint) return; if(!ifPrint) return;
var tip = content; var tip = content;
console.log(tip); console.log(tip);
} }

View File

@ -18,7 +18,8 @@ function webInterface(config){
ipAddress = config.ip, ipAddress = config.ip,
userRule = config.userRule, userRule = config.userRule,
ruleSummary = "", ruleSummary = "",
customMenu = []; customMenu = [],
server;
try{ try{
ruleSummary = userRule.summary(); ruleSummary = userRule.summary();
@ -111,13 +112,14 @@ function webInterface(config){
//plugin from rule file //plugin from rule file
if(typeof userRule._plugIntoWebinterface == "function"){ if(typeof userRule._plugIntoWebinterface == "function"){
userRule._plugIntoWebinterface(app,function(){ userRule._plugIntoWebinterface(app,function(){
app.listen(port); server = app.listen(port);
}); });
}else{ }else{
app.listen(port); server = app.listen(port);
} }
self.app = app; self.app = app;
self.server = server;
} }
inherits(webInterface, events.EventEmitter); inherits(webInterface, events.EventEmitter);

View File

@ -1,6 +1,6 @@
{ {
"name": "anyproxy", "name": "anyproxy",
"version": "3.7.6", "version": "3.7.7",
"description": "A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.", "description": "A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.",
"main": "proxy.js", "main": "proxy.js",
"bin": { "bin": {

View File

@ -63,9 +63,7 @@ function proxyServer(option){
socketPort = option.socketPort || DEFAULT_WEBSOCKET_PORT, //port for websocket socketPort = option.socketPort || DEFAULT_WEBSOCKET_PORT, //port for websocket
proxyConfigPort = option.webConfigPort || DEFAULT_CONFIG_PORT, //port to ui config server proxyConfigPort = option.webConfigPort || DEFAULT_CONFIG_PORT, //port to ui config server
disableWebInterface = !!option.disableWebInterface, disableWebInterface = !!option.disableWebInterface,
ifSilent = !!option.silent, ifSilent = !!option.silent;
webServerInstance,
ws;
if(ifSilent){ if(ifSilent){
logUtil.setPrintStatus(false); logUtil.setPrintStatus(false);
@ -131,8 +129,8 @@ function proxyServer(option){
//start web socket service //start web socket service
function(callback){ function(callback){
ws = new wsServer({port : socketPort}); self.ws = new wsServer({port : socketPort});
callback(null) callback(null);
}, },
//start web interface //start web interface
@ -147,7 +145,7 @@ function proxyServer(option){
ip : ip.address() ip : ip.address()
}; };
webServerInstance = new webInterface(config); self.webServerInstance = new webInterface(config);
} }
callback(null); callback(null);
}, },
@ -189,7 +187,9 @@ function proxyServer(option){
self.close = function(){ self.close = function(){
self.httpProxyServer && self.httpProxyServer.close(); self.httpProxyServer && self.httpProxyServer.close();
logUtil.printLog(color.green("server closed :" + proxyHost + ":" + proxyPort)); self.ws && self.ws.closeAll();
self.webServerInstance && self.webServerInstance.server && self.webServerInstance.server.close();
logUtil.printLog("server closed :" + proxyHost + ":" + proxyPort);
} }
} }