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:
* optimize detail panel, ref #35

View File

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

View File

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

View File

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

View File

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