File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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 } ) ;
1817 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 {
@@ -28,8 +28,7 @@ export function useProxyForMongo(config: Config) {
2828 for ( const socket of sockets ) {
2929 await new Promise ( ( resolve , reject ) => {
3030 socket . on ( 'close' , ( ) => {
31- console . log ( `Socket ${ socket . remoteAddress } : ` , socket . closed ) ;
32- console . log ( 'Socket is paused: ' , socket . isPaused ( ) ) ;
31+ socket . unref ( ) ;
3332 resolve ( true ) ;
3433 } ) ;
3534 socket . end ( ) ;
You can’t perform that action at this time.
0 commit comments