MCPcopy
hub / github.com/di-sukharev/opencommit / createSocket

Method createSocket

out/cli.cjs:26036–26058  ·  view source on GitHub ↗
(req, options, cb)

Source from the content-addressed store, hash-verified

26034 return super.getName(options);
26035 }
26036 createSocket(req, options, cb) {
26037 const connectOpts = {
26038 ...options,
26039 secureEndpoint: this.isSecureEndpoint(options)
26040 };
26041 const name = this.getName(connectOpts);
26042 const fakeSocket = this.incrementSockets(name);
26043 Promise.resolve().then(() => this.connect(req, connectOpts)).then((socket) => {
26044 this.decrementSockets(name, fakeSocket);
26045 if (socket instanceof http4.Agent) {
26046 try {
26047 return socket.addRequest(req, connectOpts);
26048 } catch (err) {
26049 return cb(err);
26050 }
26051 }
26052 this[INTERNAL2].currentSocket = socket;
26053 super.createSocket(req, options, cb);
26054 }, (err) => {
26055 this.decrementSockets(name, fakeSocket);
26056 cb(err);
26057 });
26058 }
26059 createConnection() {
26060 const socket = this[INTERNAL2].currentSocket;
26061 this[INTERNAL2].currentSocket = void 0;

Callers

nothing calls this directly

Calls 7

isSecureEndpointMethod · 0.80
getNameMethod · 0.80
incrementSocketsMethod · 0.80
thenMethod · 0.80
connectMethod · 0.80
decrementSocketsMethod · 0.80
addRequestMethod · 0.80

Tested by

no test coverage detected