File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed
Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ interface Config {
1414 */
1515export function useProxyForMongo ( config : Config ) {
1616 const sockets : tls . TLSSocket [ ] = [ ] ;
17+ const proxy = new HttpsProxySocket ( `https://${ config . proxy } ` , { auth : config . auth } ) ;
1718 socks . SocksClient . createConnection = async ( options , callback ) => {
18- const proxy = new HttpsProxySocket ( `https://${ config . proxy } ` , { auth : config . auth } ) ;
1919 const socket = await proxy . connect ( { host : options . destination . host , port : options . destination . port } ) ;
2020 sockets . push ( socket ) ;
2121 return {
@@ -27,10 +27,7 @@ export function useProxyForMongo(config: Config) {
2727 console . log ( `Closing ${ sockets . length } open proxy sockets` ) ;
2828 for ( const socket of sockets ) {
2929 await new Promise ( ( resolve , reject ) => {
30- socket . on ( 'close' , ( ) => {
31- socket . destroy ( ) ;
32- resolve ( socket ) ;
33- } ) ;
30+ socket . on ( 'close' , ( ) => resolve ) ;
3431 socket . end ( ) ;
3532 } ) ;
3633 }
You can’t perform that action at this time.
0 commit comments