@@ -211,7 +211,6 @@ export class RetryingCall implements Call, DeadlineInfoProvider {
211211 private nextRetryBackoffSec = 0 ;
212212 private startTime : Date ;
213213 private maxAttempts : number ;
214- private halfClosed : boolean = false ;
215214 constructor (
216215 private readonly channel : InternalChannel ,
217216 private readonly callConfig : CallConfig ,
@@ -790,11 +789,8 @@ export class RetryingCall implements Call, DeadlineInfoProvider {
790789 ) ;
791790 break ;
792791 case 'HALF_CLOSE' :
793- if ( this . halfClosed !== true ) {
794- childCall . nextMessageToSend += 1 ;
795- childCall . call . halfClose ( ) ;
796- this . halfClosed = true ;
797- }
792+ childCall . nextMessageToSend += 1 ;
793+ childCall . call . halfClose ( ) ;
798794 break ;
799795 case 'FREED' :
800796 // Should not be possible
@@ -872,13 +868,12 @@ export class RetryingCall implements Call, DeadlineInfoProvider {
872868 allocated : false ,
873869 } ) ;
874870 for ( const call of this . underlyingCalls ) {
875- if ( call ?. state === 'ACTIVE' && this . halfClosed !== true ) {
876- // || call.nextMessageToSend === halfCloseIndex - 1 added to not wait for write callback
877- if ( call . nextMessageToSend === halfCloseIndex || call . nextMessageToSend === halfCloseIndex - 1 ) {
878- call . nextMessageToSend += 1 ;
879- call . call . halfClose ( ) ;
880- this . halfClosed = true ;
881- }
871+ if (
872+ call ?. state === 'ACTIVE' &&
873+ call . nextMessageToSend === halfCloseIndex
874+ ) {
875+ call . nextMessageToSend += 1 ;
876+ call . call . halfClose ( ) ;
882877 }
883878 }
884879 }
@@ -900,4 +895,4 @@ export class RetryingCall implements Call, DeadlineInfoProvider {
900895 return null ;
901896 }
902897 }
903- }
898+ }
0 commit comments