Sfoglia il codice sorgente

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 anni fa
parent
commit
51615ca6bb
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  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)