mirror of https://github.com/qt/qtgrpc.git
grpc: Add the missing call of the finished() signal
Add the missing call of the finished() signal to the native-based implementation of gRPC stream. Emit both errorOccured and finished when the stream is finished with error. This behavior is aligned with the behavior of QNetworkReply. Task-number: QTBUG-108212 Change-Id: I3f45e33c89aca1cd258066a9f7b3df846ceeccc2 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
e02a320d98
commit
b5662a170f
|
|
@ -289,6 +289,7 @@ void QGrpcChannelPrivate::stream(QGrpcStream *stream, const QString &service,
|
|||
if (sub->status.code() != QGrpcStatus::Ok) {
|
||||
stream->errorOccurred(sub->status);
|
||||
}
|
||||
stream->finished();
|
||||
});
|
||||
|
||||
*abortConnection = QObject::connect(stream, &QGrpcStream::finished, sub.get(),
|
||||
|
|
|
|||
|
|
@ -390,9 +390,8 @@ void QGrpcHttp2Channel::stream(QGrpcStream *grpcStream, const QString &service,
|
|||
grpcStream->errorOccurred(QGrpcStatus{
|
||||
grpcStatus,
|
||||
QLatin1StringView(networkReply->rawHeader(GrpcStatusMessage)) });
|
||||
} else {
|
||||
grpcStream->finished();
|
||||
}
|
||||
grpcStream->finished();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -260,9 +260,6 @@ void QtGrpcClientTest::StreamStringTest()
|
|||
|
||||
void QtGrpcClientTest::StreamStringAndAbortTest()
|
||||
{
|
||||
// TODO
|
||||
QSKIP("Fix-me: QTBUG-10821");
|
||||
|
||||
SimpleStringMessage result;
|
||||
SimpleStringMessage request;
|
||||
request.setTestFieldString("Stream");
|
||||
|
|
@ -284,15 +281,12 @@ void QtGrpcClientTest::StreamStringAndAbortTest()
|
|||
|
||||
void QtGrpcClientTest::StreamStringAndDeferredAbortTest()
|
||||
{
|
||||
// TODO
|
||||
QSKIP("Fix-me: QTBUG-10821");
|
||||
|
||||
SimpleStringMessage result;
|
||||
SimpleStringMessage request;
|
||||
request.setTestFieldString("Stream");
|
||||
|
||||
auto stream = _client->streamTestMethodServerStream(request);
|
||||
QTimer::singleShot(3100, stream.get(), [stream]() { stream->abort(); });
|
||||
QTimer::singleShot(3400, stream.get(), [stream]() { stream->abort(); });
|
||||
|
||||
QSignalSpy streamFinishedSpy(stream.get(), &QGrpcStream::finished);
|
||||
QVERIFY(streamFinishedSpy.isValid());
|
||||
|
|
@ -456,9 +450,6 @@ void QtGrpcClientTest::StreamAndGetAsyncReplyTest()
|
|||
|
||||
void QtGrpcClientTest::MultipleStreamsTest()
|
||||
{
|
||||
// TODO
|
||||
QSKIP("Fix-me: QTBUG-10821");
|
||||
|
||||
SimpleStringMessage result;
|
||||
SimpleStringMessage request;
|
||||
request.setTestFieldString("Stream");
|
||||
|
|
|
|||
Loading…
Reference in New Issue