exposed `.end` method on the wsclient
This commit is contained in:
parent
22d813e4e9
commit
1a65027fe0
|
@ -151,7 +151,7 @@ function connectTunnel() {
|
|||
});
|
||||
console.info('');
|
||||
|
||||
stunnel.connect({
|
||||
var tun = stunnel.connect({
|
||||
stunneld: program.stunneld
|
||||
, locals: program.locals
|
||||
, services: program.services
|
||||
|
@ -159,6 +159,17 @@ function connectTunnel() {
|
|||
, insecure: program.insecure
|
||||
, token: program.token
|
||||
});
|
||||
|
||||
function sigHandler() {
|
||||
console.log('SIGINT');
|
||||
|
||||
// We want to handle cleanup properly unless something is broken in our cleanup process
|
||||
// that prevents us from exitting, in which case we want the user to be able to send
|
||||
// the signal again and exit the way it normally would.
|
||||
process.removeListener('SIGINT', sigHandler);
|
||||
tun.end();
|
||||
}
|
||||
process.on('SIGINT', sigHandler);
|
||||
}
|
||||
|
||||
function rawTunnel() {
|
||||
|
|
13
wsclient.js
13
wsclient.js
|
@ -272,14 +272,8 @@ function run(copts) {
|
|||
}
|
||||
connect();
|
||||
|
||||
function sigHandler() {
|
||||
console.log('SIGINT');
|
||||
|
||||
// We want to handle cleanup properly unless something is broken in our cleanup process
|
||||
// that prevents us from exitting, in which case we want the user to be able to send
|
||||
// the signal again and exit the way it normally would.
|
||||
process.removeListener('SIGINT', sigHandler);
|
||||
|
||||
return {
|
||||
end: function() {
|
||||
retry = false;
|
||||
if (timeoutId) {
|
||||
clearTimeout(timeoutId);
|
||||
|
@ -295,9 +289,10 @@ function run(copts) {
|
|||
}
|
||||
}
|
||||
}
|
||||
process.on('SIGINT', sigHandler);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports.connect = run;
|
||||
module.exports.createConnection = run;
|
||||
|
||||
}());
|
||||
|
|
Loading…
Reference in New Issue