MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / createConnection

Method createConnection

cli/release/http.js:114–137  ·  view source on GitHub ↗
(_options, callback)

Source from the content-addressed store, hash-verified

112
113 class TunnelAgent extends httpsModule.Agent {
114 createConnection(_options, callback) {
115 const secureSocket = tlsModule.connect({
116 socket: tunnelSocket,
117 servername: parsedUrl.hostname,
118 })
119
120 if (typeof callback === 'function') {
121 if (typeof secureSocket.once === 'function') {
122 let settled = false
123 const finish = (error) => {
124 if (settled) return
125 settled = true
126 callback(error || null, error ? undefined : secureSocket)
127 }
128
129 secureSocket.once('secureConnect', () => finish(null))
130 secureSocket.once('error', (error) => finish(error))
131 } else {
132 callback(null, secureSocket)
133 }
134 }
135
136 return secureSocket
137 }
138 }
139
140 reqOptions.agent = new TunnelAgent({ keepAlive: false })

Callers 1

getFunction · 0.45

Calls 2

connectMethod · 0.80
onceMethod · 0.80

Tested by 1

getFunction · 0.36