File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ export class HttpsProxySocket {
149149 // nullify the buffered data since we won't be needing it
150150 buffers = [ ] ;
151151
152- // cleanup();
152+ cleanup ( ) ;
153153 cb ( null , sock ) ;
154154 } else {
155155 // some other status code that's not 200... need to re-play the HTTP header
Original file line number Diff line number Diff line change @@ -15,9 +15,9 @@ interface Config {
1515 */
1616export function useProxyForMongo ( config : Config ) {
1717 const sockets : tls . TLSSocket [ ] = [ ] ;
18+ let proxy : HttpsProxySocket | undefined = new HttpsProxySocket ( `https://${ config . proxy } ` , { auth : config . auth } ) ;
1819 socks . SocksClient . createConnection = async ( options , callback ) => {
19- const proxy = new HttpsProxySocket ( `https://${ config . proxy } ` , { auth : config . auth } ) ;
20- const socket = await proxy . connect ( { host : options . destination . host , port : options . destination . port } ) ;
20+ const socket = await proxy ! . connect ( { host : options . destination . host , port : options . destination . port } ) ;
2121 sockets . push ( socket ) ;
2222 return {
2323 socket,
@@ -38,6 +38,7 @@ export function useProxyForMongo(config: Config) {
3838 } ) ,
3939 ) ,
4040 ) ;
41+ proxy = undefined ;
4142 if ( count === sockets . length ) {
4243 console . log ( `Closed ${ sockets . length } MongoDB connection sockets` ) ;
4344 }
You can’t perform that action at this time.
0 commit comments