grpc-js: Add secureConnection error handling in server

This commit is contained in:
Michael Lumish 2022-01-18 12:35:22 -08:00
parent 903cce1df9
commit db56e80b21
1 changed files with 7 additions and 0 deletions

View File

@ -371,6 +371,13 @@ export class Server {
creds._getSettings()!
);
http2Server = http2.createSecureServer(secureServerOptions);
http2Server.on('secureConnection', (socket: TLSSocket) => {
/* These errors need to be handled by the user of Http2SecureServer,
* according to https://github.com/nodejs/node/issues/35824 */
socket.on('error', (e: Error) => {
this.trace('An incoming TLS connection closed with error: ' + e.message);
});
});
} else {
http2Server = http2.createServer(serverOptions);
}