Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
server.listen(0, common.mustCall(() => {
const client = http2.connect(`http://localhost:${server.address().port}`);
const req = client.request();
req.on('close', common.mustCall(() => {
client.close();
server.close();
}));
req.end();
}));
server.listen(0, common.mustCall(() => {
const client = http2.connect(`http://localhost:${server.address().port}`);
const req = client.request();
req.on('end', common.mustCall(() => {
client.close();
server.close();
}));
req.resume();
req.end();
}));
server.listen(0, common.mustCall(() => {
const client = h2.connect(`http://localhost:${server.address().port}`);
const req = client.request();
req.priority({});
req.on('response', common.mustCall());
req.resume();
req.on('end', common.mustCall());
req.on('close', common.mustCall(() => {
server.close();
client.close();
}));
}));
server.listen(0, common.mustCall(() => {
const port = server.address().port;
const client = http2.connect(`http://localhost:${port}`);
const req = client.request({
':path': '/',
':method': 'GET',
':scheme': 'http',
':authority': `localhost:${port}`
});
req.on('end', common.mustCall(() => {
client.close();
}));
req.resume();
req.end();
}));
server.listen(0, common.mustCall(() => {
const client = http2.connect(`http://localhost:${server.address().port}`);
const req = client.request();
req.resume();
req.on('close', common.mustCall(() => {
client.close();
server.close();
}));
}));
private async connectAndKeepAlive(backend: string) {
while (!this.isShutdown) {
if (!this.grpcClient || this.grpcClient.destroyed) {
this.grpcClient = http2.connect(backend);
this.grpcClient.on("connect", () => {
console.info(`Successfully connected to backend: ${backend}`);
});
this.grpcClient.on("error", error => {
console.error(`Failed to connect to backend: ${backend}\n${error}`);
});
}
await new Promise(resolve => setTimeout(resolve, 1000));
}
}
constructor(private readonly buildServiceEndpoint: string,
private readonly projectInfoManager: ProjectInfoManager,
private readonly unpackedDirectory: string,
private readonly outDir: string,
private readonly packager: PlatformPackager) {
log.debug({endpoint: buildServiceEndpoint}, "connect to remote build service")
this.client = connect(buildServiceEndpoint, getConnectOptions())
}
return new Promise((resolve, reject) => {
let session = http2.connect(this._url)
session.once('error', reject)
session.once('socketError', reject)
session.once('connect', () => {
this._connected(session)
resolve(this)
})
})
}
const promise = new Promise((resolve, reject) => {
session =
http2_1.connect(origin, options, () => resolve(session));
session.on('stream', pushHandler);
session.once('close', () => reject(makeOkError(makeError())));
session.once('timeout', () => reject(makeConnectionTimeout()));
session.once('error', reject);
});
return { promise, session };