File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @grpc/grpc-js" ,
3
- "version" : " 1.3.6 " ,
3
+ "version" : " 1.3.7 " ,
4
4
"description" : " gRPC Library for Node - pure JS implementation" ,
5
5
"homepage" : " https://grpc.io/" ,
6
6
"repository" : " https://github.com/grpc/grpc-node/tree/master/packages/grpc-js" ,
Original file line number Diff line number Diff line change @@ -660,7 +660,15 @@ export class Http2CallStream implements Call {
660
660
this . pendingWrite . length +
661
661
' (deferred)'
662
662
) ;
663
- stream . write ( this . pendingWrite , this . pendingWriteCallback ) ;
663
+ try {
664
+ stream . write ( this . pendingWrite , this . pendingWriteCallback ) ;
665
+ } catch ( error ) {
666
+ this . endCall ( {
667
+ code : Status . UNAVAILABLE ,
668
+ details : `Write failed with error ${ error . message } ` ,
669
+ metadata : new Metadata ( )
670
+ } ) ;
671
+ }
664
672
}
665
673
this . maybeCloseWrites ( ) ;
666
674
}
@@ -788,7 +796,15 @@ export class Http2CallStream implements Call {
788
796
this . pendingWriteCallback = cb ;
789
797
} else {
790
798
this . trace ( 'sending data chunk of length ' + message . message . length ) ;
791
- this . http2Stream . write ( message . message , cb ) ;
799
+ try {
800
+ this . http2Stream . write ( message . message , cb ) ;
801
+ } catch ( error ) {
802
+ this . endCall ( {
803
+ code : Status . UNAVAILABLE ,
804
+ details : `Write failed with error ${ error . message } ` ,
805
+ metadata : new Metadata ( )
806
+ } ) ;
807
+ }
792
808
this . maybeCloseWrites ( ) ;
793
809
}
794
810
} , this . handleFilterError . bind ( this ) ) ;
Original file line number Diff line number Diff line change @@ -431,7 +431,7 @@ export class Http2ServerCallStream<
431
431
private checkCancelled ( ) : boolean {
432
432
/* In some cases the stream can become destroyed before the close event
433
433
* fires. That creates a race condition that this check works around */
434
- if ( this . stream . destroyed ) {
434
+ if ( this . stream . destroyed || this . stream . closed ) {
435
435
this . cancelled = true ;
436
436
}
437
437
return this . cancelled ;
You can’t perform that action at this time.
0 commit comments