Skip to content

Conversation

kjin
Copy link
Contributor

@kjin kjin commented Dec 19, 2017

grpc-js-core: unref http2 client socket

The ClientHttp2Session keeps the process alive after all requests are completed; this change works around that.

grpc-js-core: emit status on client stream calls

I think client stream calls are supposed to emit the 'status' event, so I added it here.

grpc-js-core: fixing credentials functions

This change promisifies Http2Channel#connect and makes small changes to credentials-related files to pass the api/credentials_test.js test suite.

grpc-js-core: fixes for interop test

This is a set of changes intended to allow the js client to pass the interop test suite.

@kjin kjin requested a review from murgatroid99 December 19, 2017 17:38
certChain?: Buffer|null): ChannelCredentials {
verifyIsBufferOrNull(rootCerts, 'Root certificate');
verifyIsBufferOrNull(privateKey, 'Private key');
verifyIsBufferOrNull(certChain, 'Certificate chain');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these not redundant with the argument type annotations?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TS doesn't auto-generate sentinel checks in JS, its typings are only enforced for other TS files. The credentials test depends on these checks existing, and is written in JS.

* @param options Options used in generating the Metadata object.
*/
generateMetadata(options: {}): Promise<Metadata>;
generateMetadata(options?: {}): Promise<Metadata>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why make options optional here, but not in the implementations?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops -- this was a leftover from some experimentation. I didn't intend to make this optional

removeListener(event: 'metadata', listener: (metadata: Metadata) => void):
this;

addListener(event: 'status', listener: (status: StatusObject) => void): this;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to this file do not match the existing implementation, which only emits the status event for calls with response streaming.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like that's not the case -- this test depends on 'status' being emitted for a unary call:

it('should be present when a unary call succeeds', function(done) {
var call = client.unary({error: false}, function(err, data) {
assert.ifError(err);
});
call.on('status', function(status) {
assert.deepEqual(status.metadata.get('trailer-present'), ['yes']);
done();
});
});

@kjin kjin force-pushed the grpc-js-core-work-2 branch from 08314a9 to 18279fa Compare December 20, 2017 00:43
@kjin
Copy link
Contributor Author

kjin commented Dec 20, 2017

@murgatroid99 PTAL. The only change should be options? to options per your comment.

@kjin kjin merged commit 78f6458 into grpc:master Dec 20, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants