@@ -82,7 +82,7 @@ GrpcAsyncSegmentReporterClient::~GrpcAsyncSegmentReporterClient() {
8282 // failed to send message and close stream, then recreate new stream and try
8383 // to do it. This process will continue forever without sending explicit
8484 // signal.
85- {
85+ if (stream_) {
8686 std::unique_lock<std::mutex> lck (mux_);
8787 while (!drained_messages_.empty ()) {
8888 cv_.wait (lck);
@@ -149,9 +149,6 @@ GrpcAsyncSegmentReporterStream::~GrpcAsyncSegmentReporterStream() {
149149 }
150150 }
151151 gpr_log (GPR_INFO, " %ld pending messages drained." , pending_messages_size);
152-
153- ctx_.TryCancel ();
154- request_writer_->Finish (&status_, toTag (&finish_));
155152}
156153
157154bool GrpcAsyncSegmentReporterStream::startStream () {
@@ -184,7 +181,7 @@ bool GrpcAsyncSegmentReporterStream::clearPendingMessages() {
184181 return true ;
185182}
186183
187- bool GrpcAsyncSegmentReporterStream::handleOperation (Operation incoming_op) {
184+ void GrpcAsyncSegmentReporterStream::handleOperation (Operation incoming_op) {
188185 state_ = incoming_op;
189186 if (state_ == Operation::Connected) {
190187 gpr_log (GPR_INFO, " Established connection: %s" ,
@@ -209,16 +206,9 @@ bool GrpcAsyncSegmentReporterStream::handleOperation(Operation incoming_op) {
209206 if (pending_messages_.empty ()) {
210207 cv_.notify_all ();
211208 }
212- return true ;
213- } else if (state_ == Operation::Finished) {
214- gpr_log (GPR_INFO, " Stream closed with http status: %d" ,
215- grpcStatusToGenericHttpStatus (status_.error_code ()));
216- if (!status_.ok ()) {
217- gpr_log (GPR_ERROR, " %s" , status_.error_message ().c_str ());
218- }
219- return false ;
209+ } else {
210+ throw TracerException (" Unknown stream operation" );
220211 }
221- throw TracerException (" Unknown stream operation" );
222212}
223213
224214AsyncStreamPtr<TracerRequestType> GrpcAsyncSegmentReporterStreamFactory::create (
0 commit comments