Browse Source

Fix handling of gRPC errors when the stream is finished

- Handle the gRPC errors if the assigned QNetworkReply is finished
  without network error and send the QGrpcStream::finish() signal
  if no gRPC error received from server.
- Cancel all gRPC streams when re-attaching the channel.

Fixes #259
Alexey Edelev 2 years ago
parent
commit
51615ca6bb
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/grpc/qabstractgrpcclient.cpp

+ 3 - 0
src/grpc/qabstractgrpcclient.cpp

@@ -71,6 +71,9 @@ void QAbstractGrpcClient::attachChannel(const std::shared_ptr<QAbstractGrpcChann
     }
     dPtr->channel = channel;
     dPtr->serializer = channel->serializer();
+    for (auto stream : dPtr->activeStreams) {
+        stream->cancel();
+    }
 }
 
 QGrpcStatus QAbstractGrpcClient::call(const QString &method, const QByteArray &arg, QByteArray &ret)