mirror of
https://github.com/grpc/grpc-node.git
synced 2025-12-08 18:23:54 +00:00
Merge pull request #221 from murgatroid99/interop_cancel_fixes
Don't handle already-finished call in channel
This commit is contained in:
commit
aeb8175cf0
@ -239,20 +239,18 @@ export class Http2Channel extends EventEmitter implements Channel {
|
||||
headers[HTTP2_HEADER_METHOD] = 'POST';
|
||||
headers[HTTP2_HEADER_PATH] = methodName;
|
||||
headers[HTTP2_HEADER_TE] = 'trailers';
|
||||
if (stream.getStatus() === null) {
|
||||
if (this.connectivityState === ConnectivityState.READY) {
|
||||
const session: http2.ClientHttp2Session = this.subChannel!;
|
||||
// Prevent the HTTP/2 session from keeping the process alive.
|
||||
// Note: this function is only available in Node 9
|
||||
session.unref();
|
||||
stream.attachHttp2Stream(session.request(headers));
|
||||
} else {
|
||||
/* In this case, we lost the connection while finalizing
|
||||
* metadata. That should be very unusual */
|
||||
setImmediate(() => {
|
||||
this.startHttp2Stream(methodName, stream, metadata);
|
||||
});
|
||||
}
|
||||
if (this.connectivityState === ConnectivityState.READY) {
|
||||
const session: http2.ClientHttp2Session = this.subChannel!;
|
||||
// Prevent the HTTP/2 session from keeping the process alive.
|
||||
// Note: this function is only available in Node 9
|
||||
session.unref();
|
||||
stream.attachHttp2Stream(session.request(headers));
|
||||
} else {
|
||||
/* In this case, we lost the connection while finalizing
|
||||
* metadata. That should be very unusual */
|
||||
setImmediate(() => {
|
||||
this.startHttp2Stream(methodName, stream, metadata);
|
||||
});
|
||||
}
|
||||
}).catch((error: Error & { code: number }) => {
|
||||
// We assume the error code isn't 0 (Status.OK)
|
||||
|
||||
@ -11,7 +11,6 @@ function getImplementation(globalField) {
|
||||
'If running from the command line, please --require a fixture first.'
|
||||
].join(' '));
|
||||
}
|
||||
console.error(globalField, global[globalField]);
|
||||
const impl = global[globalField];
|
||||
return require(`../packages/grpc-${impl}-core`);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user