mirror of https://github.com/grpc/grpc-node.git
Handle unauthorized TLS connections correctly
This commit is contained in:
parent
bb6fff7ff5
commit
b44b14d831
|
@ -262,6 +262,10 @@ class SecureConnectorImpl implements SecureConnector {
|
|||
};
|
||||
return new Promise<SecureConnectResult>((resolve, reject) => {
|
||||
const tlsSocket = tlsConnect(tlsConnectOptions, () => {
|
||||
if (!tlsSocket.authorized) {
|
||||
reject(tlsSocket.authorizationError);
|
||||
return;
|
||||
}
|
||||
resolve({
|
||||
socket: tlsSocket,
|
||||
secure: true
|
||||
|
@ -340,6 +344,10 @@ class CertificateProviderChannelCredentialsImpl extends ChannelCredentials {
|
|||
...connnectionOptions
|
||||
}
|
||||
const tlsSocket = tlsConnect(tlsConnectOptions, () => {
|
||||
if (!tlsSocket.authorized) {
|
||||
reject(tlsSocket.authorizationError);
|
||||
return;
|
||||
}
|
||||
resolve({
|
||||
socket: tlsSocket,
|
||||
secure: true
|
||||
|
|
|
@ -225,8 +225,8 @@ class Http2Transport implements Transport {
|
|||
this.handleDisconnect();
|
||||
});
|
||||
|
||||
session.socket.once('close', () => {
|
||||
this.trace('connection closed');
|
||||
session.socket.once('close', (hadError) => {
|
||||
this.trace('connection closed. hadError=' + hadError);
|
||||
this.handleDisconnect();
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue