mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-07-27 07:45:41 +00:00
update doc ,ready to push to npm
This commit is contained in:
@@ -41,11 +41,12 @@ function asyncTaskMgr(){
|
||||
while(tmpCb = task.callbackList.shift()){
|
||||
tmpCb && tmpCb.apply(null,task.result);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
module.exports = asyncTaskMgr;
|
||||
|
@@ -4,7 +4,7 @@ var exec = require('child_process').exec,
|
||||
fs = require("fs"),
|
||||
os = require("os"),
|
||||
color = require('colorful'),
|
||||
asyncTask = require("./asyncTaskMgr");
|
||||
asyncTask = require("async-task-mgr");
|
||||
|
||||
var certDir = path.join(getUserHome(),"/.anyproxy_certs/"),
|
||||
cmdDir = path.join(__dirname,"..","./cert/"),
|
||||
@@ -19,16 +19,16 @@ function getCertificate(hostname,cb){
|
||||
crtFile = path.join(certDir , "__hostname.crt".replace(/__hostname/,hostname) );
|
||||
|
||||
if(!fs.existsSync(keyFile) || !fs.existsSync(crtFile)){
|
||||
asyncTaskMgr.addTask(hostname,function(err){
|
||||
asyncTaskMgr.addTask(hostname,function(cb){
|
||||
createCert(hostname,function(err){
|
||||
cb(err ? err : null);
|
||||
});
|
||||
},function(err){
|
||||
if(!err){
|
||||
cb(null , fs.readFileSync(keyFile) , fs.readFileSync(crtFile) );
|
||||
}else{
|
||||
cb(err);
|
||||
}
|
||||
},function(cb){
|
||||
createCert(hostname,function(err){
|
||||
cb(err ? -1 : null);
|
||||
});
|
||||
});
|
||||
|
||||
}else{
|
||||
|
@@ -8,7 +8,7 @@ var getPort = require('./getPort'),
|
||||
url = require('url'),
|
||||
color = require('colorful'),
|
||||
certMgr = require("./certMgr"),
|
||||
asyncTask = require("./asyncTaskMgr");
|
||||
asyncTask = require("async-task-mgr");
|
||||
|
||||
var DEFAULT_RELEASE_TIME = 120*1000;
|
||||
|
||||
@@ -40,9 +40,10 @@ module.exports =function(){
|
||||
//create server with corresponding CA
|
||||
}else{
|
||||
|
||||
asyncTaskMgr.addTask(hostname ,userCB,function(cb){
|
||||
createServer(cb);
|
||||
});
|
||||
asyncTaskMgr.addTask(hostname, createServer ,userCB);
|
||||
// ,function(cb){
|
||||
// createServer(cb);
|
||||
// });
|
||||
|
||||
function createServer(cb){
|
||||
async.series([
|
||||
|
Reference in New Issue
Block a user