fixed a few minor things

This commit is contained in:
tigerbot 2017-05-01 17:52:22 -06:00
parent aed520a653
commit dbd1e23bfa
3 changed files with 8 additions and 5 deletions

View File

@ -166,7 +166,7 @@ else if (process.argv.length > 2) {
var program = require('commander'); var program = require('commander');
program program
.version(require('package.json').version) .version(require('../package.json').version)
.option('--agree-tos [url1,url2]', "agree to all Terms of Service for Daplie, Let's Encrypt, etc (or specific URLs only)") .option('--agree-tos [url1,url2]', "agree to all Terms of Service for Daplie, Let's Encrypt, etc (or specific URLs only)")
.option('--config', 'Path to config file (Goldilocks.json or Goldilocks.yml) example: --config /etc/goldilocks/Goldilocks.json') .option('--config', 'Path to config file (Goldilocks.json or Goldilocks.yml) example: --config /etc/goldilocks/Goldilocks.json')
.option('--tunnel [token]', 'Turn tunnel on. This will enter interactive mode for login if no token is specified.') .option('--tunnel [token]', 'Turn tunnel on. This will enter interactive mode for login if no token is specified.')

View File

@ -6,7 +6,7 @@ module.exports.addTcpListener = function (port, handler) {
var PromiseA = require('bluebird'); var PromiseA = require('bluebird');
return new PromiseA(function (resolve, reject) { return new PromiseA(function (resolve, reject) {
var stat = serversMap[port] || serversMap[port]; var stat = serversMap[port];
if (stat) { if (stat) {
if (stat._closing) { if (stat._closing) {
@ -37,6 +37,10 @@ module.exports.addTcpListener = function (port, handler) {
, _closing: false , _closing: false
}; };
// Add .destroy so we can close all open connections. Better if added before listen
// to eliminate any possibility of it missing an early connection in it's records.
enableDestroy(server);
server.on('connection', function (conn) { server.on('connection', function (conn) {
conn.__port = port; conn.__port = port;
conn.__proto = 'tcp'; conn.__proto = 'tcp';
@ -62,8 +66,6 @@ module.exports.addTcpListener = function (port, handler) {
resolved = true; resolved = true;
resolve(); resolve();
}); });
enableDestroy(server); // adds .destroy
}); });
}; };
module.exports.closeTcpListener = function (port) { module.exports.closeTcpListener = function (port) {
@ -72,6 +74,7 @@ module.exports.closeTcpListener = function (port) {
return new PromiseA(function (resolve) { return new PromiseA(function (resolve) {
var stat = serversMap[port]; var stat = serversMap[port];
if (!stat) { if (!stat) {
resolve();
return; return;
} }
stat.server.on('close', function () { stat.server.on('close', function () {

View File

@ -18,5 +18,5 @@ popd
mkdir -p well-known mkdir -p well-known
pushd well-known pushd well-known
ln -sf ../org.oauth3/well-known/oauth3 ./oauth3 ln -snf ../org.oauth3/well-known/oauth3 ./oauth3
popd popd