@@ -118,14 +118,18 @@ class ISession : public ISessionHandler<TResponse>
118118 Session->HaveWriteInflight = false ;
119119 if (Session->NeedFinish ) {
120120 lock.Release ();
121- Session->Stream .Finish (Status::OK, new TFinishDone (Session));
121+ if (!NYdbGrpc::GrpcDead) {
122+ Session->Stream .Finish (Status::OK, new TFinishDone (Session));
123+ }
122124 }
123125 } else {
124126 auto resp = std::move (Session->Responses .front ());
125127 Session->Responses .pop ();
126128 lock.Release ();
127129 ui64 sz = resp.ByteSize ();
128- Session->Stream .Write (resp, new TWriteDone (Session, sz));
130+ if (!NYdbGrpc::GrpcDead) {
131+ Session->Stream .Write (resp, new TWriteDone (Session, sz));
132+ }
129133 }
130134
131135 return false ;
@@ -271,7 +275,9 @@ class ISession : public ISessionHandler<TResponse>
271275 HaveWriteInflight = true ;
272276 }
273277
274- Stream.Finish (Status::OK, new TFinishDone (this ));
278+ if (!NYdbGrpc::GrpcDead) {
279+ Stream.Finish (Status::OK, new TFinishDone (this ));
280+ }
275281 }
276282
277283 // / Send reply to client.
@@ -289,7 +295,9 @@ class ISession : public ISessionHandler<TResponse>
289295 }
290296
291297 ui64 size = resp.ByteSize ();
292- Stream.Write (resp, new TWriteDone (this , size));
298+ if (!NYdbGrpc::GrpcDead) {
299+ Stream.Write (resp, new TWriteDone (this , size));
300+ }
293301 }
294302
295303 void ReadyForNextRead () override {
@@ -301,7 +309,9 @@ class ISession : public ISessionHandler<TResponse>
301309 }
302310
303311 auto read = new TReadDone (this );
304- Stream.Read (&read->Request , read);
312+ if (!NYdbGrpc::GrpcDead) {
313+ Stream.Read (&read->Request , read);
314+ }
305315 }
306316
307317protected:
0 commit comments