MCPcopy
hub / github.com/alibaba/anyproxy / close

Method close

proxy.js:344–376  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

342 }
343
344 close() {
345 return new Promise((resolve, reject) => {
346 super.close()
347 .then((error) => {
348 if (error) {
349 resolve(error);
350 }
351 });
352
353 if (this.recorder) {
354 logUtil.printLog('clearing cache file...');
355 this.recorder.clear();
356 }
357 const tmpWebServer = this.webServerInstance;
358 this.recorder = null;
359 this.webServerInstance = null;
360 if (tmpWebServer) {
361 logUtil.printLog('closing webserver...');
362 tmpWebServer.close((error) => {
363 if (error) {
364 console.error(error);
365 logUtil.printLog(`proxy web server close FAILED: ${error.message}`, logUtil.T_ERR);
366 } else {
367 logUtil.printLog(`proxy web server closed at ${this.proxyHostName} : ${this.webPort}`);
368 }
369
370 resolve(error);
371 })
372 } else {
373 resolve(null);
374 }
375 });
376 }
377}
378
379module.exports.ProxyCore = ProxyCore;

Callers

nothing calls this directly

Calls 2

clearMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected