1
0

2 Ревизии 51b4bca2ad ... 7f724da78a

Автор SHA1 Съобщение Дата
  Alexey Edelev 7f724da78a Fix tests to support possible QMatrix4x4 fields reordering преди 3 години
  Alexey Edelev 667f01bd17 Rename QGrpcAsyncReply to QGrpcCallReply преди 3 години

+ 1 - 1
src/generator/clientdeclarationprinter.cpp

@@ -65,7 +65,7 @@ void ClientDeclarationPrinter::printClientIncludes()
 {
     std::unordered_set<std::string> includeSet;
     includeSet.insert("QAbstractGrpcClient");
-    includeSet.insert("QGrpcAsyncReply");
+    includeSet.insert("QGrpcCallReply");
     includeSet.insert("QGrpcStream");
     for (auto type : includeSet) {
         mPrinter->Print({{"include", type}}, Templates::ExternalIncludeTemplate);

+ 1 - 1
src/generator/singlefilegenerator.cpp

@@ -210,7 +210,7 @@ bool SingleFileGenerator::GenerateServices(const ::google::protobuf::FileDescrip
     }
 
     externalIncludes.insert("QAbstractGrpcClient");
-    externalIncludes.insert("QGrpcAsyncReply");
+    externalIncludes.insert("QGrpcCallReply");
     externalIncludes.insert("QGrpcStream");
 
     if (file->message_type_count() > 0) {

+ 10 - 10
src/generator/templates.cpp

@@ -291,8 +291,8 @@ const char *Templates::ClassDefinitionTemplate = "\nclass $classname$ : public $
                                                  "{\n";
 const char *Templates::QObjectMacro = "Q_OBJECT";
 const char *Templates::ClientMethodDeclarationSyncTemplate = "QtProtobuf::QGrpcStatus $method_name$(const $param_type$ &$param_name$, const QPointer<$return_type$> &$return_name$);\n";
-const char *Templates::ClientMethodDeclarationAsyncTemplate = "QtProtobuf::QGrpcAsyncReplyShared $method_name$(const $param_type$ &$param_name$);\n";
-const char *Templates::ClientMethodDeclarationAsync2Template = "Q_INVOKABLE void $method_name$(const $param_type$ &$param_name$, const QObject *context, const std::function<void(QtProtobuf::QGrpcAsyncReplyShared)> &callback);\n";
+const char *Templates::ClientMethodDeclarationAsyncTemplate = "QtProtobuf::QGrpcCallReplyShared $method_name$(const $param_type$ &$param_name$);\n";
+const char *Templates::ClientMethodDeclarationAsync2Template = "Q_INVOKABLE void $method_name$(const $param_type$ &$param_name$, const QObject *context, const std::function<void(QtProtobuf::QGrpcCallReplyShared)> &callback);\n";
 const char *Templates::ClientMethodDeclarationQmlTemplate = "Q_INVOKABLE void $method_name$($param_type$ *$param_name$, const QJSValue &callback, const QJSValue &errorCallback);\n";
 const char *Templates::ClientMethodDeclarationQml2Template = "Q_INVOKABLE void $method_name$($param_type$ *$param_name$, $return_type$ *$return_name$, const QJSValue &errorCallback);\n";
 
@@ -306,14 +306,14 @@ const char *Templates::ClientMethodDefinitionSyncTemplate = "\nQtProtobuf::QGrpc
                                                             "{\n"
                                                             "    return call(\"$method_name$\", $param_name$, $return_name$);\n"
                                                             "}\n";
-const char *Templates::ClientMethodDefinitionAsyncTemplate = "\nQtProtobuf::QGrpcAsyncReplyShared $classname$::$method_name$(const $param_type$ &$param_name$)\n"
+const char *Templates::ClientMethodDefinitionAsyncTemplate = "\nQtProtobuf::QGrpcCallReplyShared $classname$::$method_name$(const $param_type$ &$param_name$)\n"
                                                              "{\n"
                                                              "    return call(\"$method_name$\", $param_name$);\n"
                                                              "}\n";
-const char *Templates::ClientMethodDefinitionAsync2Template = "\nvoid $classname$::$method_name$(const $param_type$ &$param_name$, const QObject *context, const std::function<void(QGrpcAsyncReplyShared)> &callback)\n"
+const char *Templates::ClientMethodDefinitionAsync2Template = "\nvoid $classname$::$method_name$(const $param_type$ &$param_name$, const QObject *context, const std::function<void(QGrpcCallReplyShared)> &callback)\n"
                                                               "{\n"
-                                                              "    QtProtobuf::QGrpcAsyncReplyShared reply = call(\"$method_name$\", $param_name$);\n"
-                                                              "    QObject::connect(reply.get(), &QtProtobuf::QGrpcAsyncReply::finished, context, [reply, callback]() {\n"
+                                                              "    QtProtobuf::QGrpcCallReplyShared reply = call(\"$method_name$\", $param_name$);\n"
+                                                              "    QObject::connect(reply.get(), &QtProtobuf::QGrpcCallReply::finished, context, [reply, callback]() {\n"
                                                               "        callback(reply);\n"
                                                               "    });\n"
                                                               "}\n";
@@ -333,8 +333,8 @@ const char *Templates::ClientMethodDefinitionQmlTemplate = "\nvoid $classname$::
                                                            "        qProtoWarning() << \"Unable to call $classname$::$method_name$, it's only callable from JS engine context\";\n"
                                                            "        return;\n"
                                                            "    }\n\n"
-                                                           "    QtProtobuf::QGrpcAsyncReplyShared reply = call(\"$method_name$\", *$param_name$);\n"
-                                                           "    reply->stream(jsEngine, [this, reply, callback, jsEngine]() {\n"
+                                                           "    QtProtobuf::QGrpcCallReplyShared reply = call(\"$method_name$\", *$param_name$);\n"
+                                                           "    reply->subscribe(jsEngine, [this, reply, callback, jsEngine]() {\n"
                                                            "        auto result = new $return_type$(reply->read<$return_type$>());\n"
                                                            "        qmlEngine(this)->setObjectOwnership(result, QQmlEngine::JavaScriptOwnership);\n"
                                                            "        QJSValue(callback).call(QJSValueList{jsEngine->toScriptValue(result)});\n"
@@ -358,8 +358,8 @@ const char *Templates::ClientMethodDefinitionQml2Template = "\nvoid $classname$:
                                                             "        qProtoWarning() << \"Unable to call $classname$::$method_name$, it's only callable from JS engine context\";\n"
                                                             "        return;\n"
                                                             "    }\n\n"
-                                                            "    QtProtobuf::QGrpcAsyncReplyShared reply = call(\"$method_name$\", *$param_name$);\n"
-                                                            "    reply->stream(jsEngine, [this, reply, jsEngine, safeReturn]() {\n"
+                                                            "    QtProtobuf::QGrpcCallReplyShared reply = call(\"$method_name$\", *$param_name$);\n"
+                                                            "    reply->subscribe(jsEngine, [this, reply, jsEngine, safeReturn]() {\n"
                                                             "        if (safeReturn.isNull()) {\n"
                                                             "            qProtoWarning() << \"Return value is destroyed. Ignore call result\";\n"
                                                             "            return;\n"

+ 2 - 2
src/grpc/CMakeLists.txt

@@ -1,7 +1,7 @@
 qt_protobuf_internal_add_library(Grpc
     SOURCES
         qgrpcasyncoperationbase.cpp
-        qgrpcasyncreply.cpp
+        qgrpccallreply.cpp
         qgrpcstream.cpp
         qgrpcstatus.cpp
         qabstractgrpcchannel.cpp
@@ -13,7 +13,7 @@ qt_protobuf_internal_add_library(Grpc
         qgrpcuserpasswordcredentials.cpp
     PUBLIC_HEADER
         qgrpcasyncoperationbase_p.h
-        qgrpcasyncreply.h
+        qgrpccallreply.h
         qgrpcstream.h
         qgrpcstatus.h
         qabstractgrpcchannel.h

+ 2 - 2
src/grpc/qabstractgrpcchannel.cpp

@@ -25,7 +25,7 @@
 
 #include "qabstractgrpcchannel.h"
 
-#include "qgrpcasyncreply.h"
+#include "qgrpccallreply.h"
 #include "qgrpcstream.h"
 #include <QThread>
 
@@ -45,7 +45,7 @@ QAbstractGrpcChannel::QAbstractGrpcChannel() : dPtr(new QAbstractGrpcChannelPriv
 
 QAbstractGrpcChannel::~QAbstractGrpcChannel() = default;
 
-void QAbstractGrpcChannel::abort(QGrpcAsyncReply *reply)
+void QAbstractGrpcChannel::abort(QGrpcCallReply *reply)
 {
     assert(reply != nullptr);
     reply->setData({});

+ 8 - 8
src/grpc/qabstractgrpcchannel.h

@@ -38,7 +38,7 @@ class QThread;
 
 namespace QtProtobuf {
 
-class QGrpcAsyncReply;
+class QGrpcCallReply;
 class QGrpcStream;
 class QAbstractGrpcClient;
 class QAbstractProtobufSerializer;
@@ -65,17 +65,17 @@ public:
     virtual QGrpcStatus call(const QString &method, const QString &service, const QByteArray &args, QByteArray &ret) = 0;
 
     /*!
-     * \brief Calls \p method asynchronously with given serialized messge \p args. Result of method call is written to QGrpcAsyncReply.
+     * \brief Calls \p method asynchronously with given serialized messge \p args. Result of method call is written to QGrpcCallReply.
      *        \note This method is asynchronous, that means it returns control imediately after it is called.
      *        \note This method should not be called directly.
      * \param[in] method remote method is called
      * \param[in] service service identified in URL path format
      * \param[in] args serialized argument message
-     * \param[out] ret QGrpcAsyncReply that will be returned to end-point user to read data once call complete.
-     *            QGrpcAsyncReply lifecycle is managed by QAbstractGrpcClient only.
-     *            \see QGrpcAsyncReply for details
+     * \param[out] ret QGrpcCallReply that will be returned to end-point user to read data once call complete.
+     *            QGrpcCallReply lifecycle is managed by QAbstractGrpcClient only.
+     *            \see QGrpcCallReply for details
      */
-    virtual void call(const QString &method, const QString &service, const QByteArray &args, QtProtobuf::QGrpcAsyncReply *ret) = 0;
+    virtual void call(const QString &method, const QString &service, const QByteArray &args, QtProtobuf::QGrpcCallReply *ret) = 0;
 
     /*!
      * \brief Streams to server-side stream to receive updates for given \p method.
@@ -102,7 +102,7 @@ protected:
      * \brief Aborts async call for given \p reply
      * \param[in] reply returned by asynchronous QAbstractGrpcChannel::call() method
      */
-    virtual void abort(QGrpcAsyncReply *reply);
+    virtual void abort(QGrpcCallReply *reply);
 
     /*!
      * \private
@@ -111,7 +111,7 @@ protected:
      */
     virtual void cancel(QGrpcStream *stream);
 
-    friend class QGrpcAsyncReply;
+    friend class QGrpcCallReply;
     friend class QGrpcStream;
 private:
     Q_DISABLE_COPY(QAbstractGrpcChannel)

+ 7 - 7
src/grpc/qabstractgrpcclient.cpp

@@ -25,7 +25,7 @@
 
 #include "qabstractgrpcclient.h"
 
-#include "qgrpcasyncreply.h"
+#include "qgrpccallreply.h"
 #include "qgrpcstream.h"
 #include "qprotobufserializerregistry_p.h"
 
@@ -94,27 +94,27 @@ QGrpcStatus QAbstractGrpcClient::call(const QString &method, const QByteArray &a
     return callStatus;
 }
 
-QGrpcAsyncReplyShared QAbstractGrpcClient::call(const QString &method, const QByteArray &arg)
+QGrpcCallReplyShared QAbstractGrpcClient::call(const QString &method, const QByteArray &arg)
 {
-    QGrpcAsyncReplyShared reply;
+    QGrpcCallReplyShared reply;
     if (thread() != QThread::currentThread()) {
-        QMetaObject::invokeMethod(this, [&]()->QGrpcAsyncReplyShared {
+        QMetaObject::invokeMethod(this, [&]()->QGrpcCallReplyShared {
                                       qProtoDebug() << "Method: " << dPtr->service << method << " called from different thread";
                                       return call(method, arg);
                                   }, Qt::BlockingQueuedConnection, &reply);
     } else if (dPtr->channel) {
-        reply.reset(new QGrpcAsyncReply(dPtr->channel, this), [](QGrpcAsyncReply *reply) { reply->deleteLater(); });
+        reply.reset(new QGrpcCallReply(dPtr->channel, this), [](QGrpcCallReply *reply) { reply->deleteLater(); });
 
         auto errorConnection = std::make_shared<QMetaObject::Connection>();
         auto finishedConnection = std::make_shared<QMetaObject::Connection>();
-        *errorConnection = connect(reply.get(), &QGrpcAsyncReply::error, this, [this, reply, errorConnection, finishedConnection](const QGrpcStatus &status) mutable {
+        *errorConnection = connect(reply.get(), &QGrpcCallReply::error, this, [this, reply, errorConnection, finishedConnection](const QGrpcStatus &status) mutable {
             error(status);
             QObject::disconnect(*finishedConnection);
             QObject::disconnect(*errorConnection);
             reply.reset();
         });
 
-        *finishedConnection = connect(reply.get(), &QGrpcAsyncReply::finished, [reply, errorConnection, finishedConnection]() mutable {
+        *finishedConnection = connect(reply.get(), &QGrpcCallReply::finished, [reply, errorConnection, finishedConnection]() mutable {
             QObject::disconnect(*finishedConnection);
             QObject::disconnect(*errorConnection);
             reply.reset();

+ 4 - 4
src/grpc/qabstractgrpcclient.h

@@ -46,7 +46,7 @@
  */
 namespace QtProtobuf {
 
-class QGrpcAsyncReply;
+class QGrpcCallReply;
 class QGrpcStream;
 class QGrpcAsyncOperationBase;
 class QAbstractGrpcChannel;
@@ -117,12 +117,12 @@ protected:
 
     /*!
      * \private
-     * \brief Calls \p method of service client asynchronously and returns pointer to assigned to call AsyncReply
+     * \brief Calls \p method of service client asynchronously and returns pointer to assigned to call QGrpcCallReply
      * \param[in] method Name of the method to be called
      * \param[in] arg Protobuf message argument for \p method
      */
     template<typename A>
-    QGrpcAsyncReplyShared call(const QString &method, const A &arg) {
+    QGrpcCallReplyShared call(const QString &method, const A &arg) {
         return call(method, arg.serialize(serializer()));
     }
 
@@ -187,7 +187,7 @@ private:
     QGrpcStatus call(const QString &method, const QByteArray &arg, QByteArray &ret);
 
     //!\private
-    QGrpcAsyncReplyShared call(const QString &method, const QByteArray &arg);
+    QGrpcCallReplyShared call(const QString &method, const QByteArray &arg);
 
     //!\private
     QGrpcStreamShared stream(const QString &method, const QByteArray &arg, const QtProtobuf::StreamHandler &handler = {});

+ 1 - 1
src/grpc/qgrpcasyncoperationbase_p.h

@@ -48,7 +48,7 @@ class Q_GRPC_EXPORT QGrpcAsyncOperationBase : public QObject
     Q_OBJECT
 public:
     /*!
-     * \brief Reads message from raw byte array stored in QGrpcAsyncReply
+     * \brief Reads message from raw byte array stored in QGrpcCallReply
      * \return Copy of deserialized message or non-initialized message in case of exceptional situation
      */
     template <typename T>

+ 2 - 2
src/grpc/qgrpcasyncreply.cpp → src/grpc/qgrpccallreply.cpp

@@ -23,13 +23,13 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-#include "qgrpcasyncreply.h"
+#include "qgrpccallreply.h"
 
 #include <QThread>
 
 using namespace QtProtobuf;
 
-void QGrpcAsyncReply::abort()
+void QGrpcCallReply::abort()
 {
     if (thread() != QThread::currentThread()) {
         QMetaObject::invokeMethod(this, [this](){m_channel->abort(this);}, Qt::BlockingQueuedConnection);

+ 16 - 16
src/grpc/qgrpcasyncreply.h → src/grpc/qgrpccallreply.h

@@ -23,7 +23,7 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-#pragma once //QGrpcAsyncReply
+#pragma once //QGrpcCallReply
 
 #include <functional>
 #include <QMutex>
@@ -39,11 +39,11 @@ namespace QtProtobuf {
 
 /*!
  * \ingroup QtGrpc
- * \brief The QGrpcAsyncReply class contains data for asynchronous call of gRPC client API. It's owned by client class, that
- *        created it. QGrpcAsyncReply could be used by QAbstractGrpcChannel implementations to control call work flow and
- *        abort calls if possible in case if QGrpcAsyncReply::abort method called by library user.
+ * \brief The QGrpcCallReply class contains data for asynchronous call of gRPC client API. It's owned by client class, that
+ *        created it. QGrpcCallReply could be used by QAbstractGrpcChannel implementations to control call work flow and
+ *        abort calls if possible in case if QGrpcCallReply::abort method called by library user.
  */
-class Q_GRPC_EXPORT QGrpcAsyncReply final : public QGrpcAsyncOperationBase
+class Q_GRPC_EXPORT QGrpcCallReply final : public QGrpcAsyncOperationBase
 {
     Q_OBJECT
 public:
@@ -53,38 +53,38 @@ public:
     void abort();
 
     /*!
-     * \brief Stream to QGrpcAsyncReply signals
+     * \brief Subscribe to QGrpcCallReply signals
      */
     template <typename Func1, typename Func2>
-    inline void stream(QObject *receiver, Func1 finishCallback, Func2 errorCallback,
+    inline void subscribe(QObject *receiver, Func1 finishCallback, Func2 errorCallback,
                                      Qt::ConnectionType type = Qt::AutoConnection)
     {
-        QObject::connect(this, &QGrpcAsyncReply::finished, receiver, finishCallback, type);
-        QObject::connect(this, &QGrpcAsyncReply::error, receiver, errorCallback, type);
+        QObject::connect(this, &QGrpcCallReply::finished, receiver, finishCallback, type);
+        QObject::connect(this, &QGrpcCallReply::error, receiver, errorCallback, type);
     }
 
     /*!
-     * \brief Overloaded QGrpcAsyncReply::stream method, to stream to finished signal
+     * \brief Overloaded QGrpcCallReply::subscribe method, to subscribe to finished signal
      *        only
      */
     template <typename Func1>
-    inline void stream(QObject *receiver, Func1 finishCallback,
+    inline void subscribe(QObject *receiver, Func1 finishCallback,
                                      Qt::ConnectionType type = Qt::AutoConnection)
     {
-        QObject::connect(this, &QGrpcAsyncReply::finished, receiver, finishCallback, type);
+        QObject::connect(this, &QGrpcCallReply::finished, receiver, finishCallback, type);
     }
 
 protected:
     //! \private
-    QGrpcAsyncReply(const std::shared_ptr<QAbstractGrpcChannel> &channel, QAbstractGrpcClient *parent) : QGrpcAsyncOperationBase(channel, parent)
+    QGrpcCallReply(const std::shared_ptr<QAbstractGrpcChannel> &channel, QAbstractGrpcClient *parent) : QGrpcAsyncOperationBase(channel, parent)
     {}
     //! \private
-    ~QGrpcAsyncReply() = default;
+    ~QGrpcCallReply() = default;
 
 private:
     //! \private
-    QGrpcAsyncReply();
-    Q_DISABLE_COPY_MOVE(QGrpcAsyncReply)
+    QGrpcCallReply();
+    Q_DISABLE_COPY_MOVE(QGrpcCallReply)
 
     friend class QAbstractGrpcClient;
 };

+ 4 - 4
src/grpc/qgrpcchannel.cpp

@@ -44,7 +44,7 @@
 #include <grpcpp/security/credentials.h>
 
 #include "qabstractgrpccredentials.h"
-#include "qgrpcasyncreply.h"
+#include "qgrpccallreply.h"
 #include "qgrpcstatus.h"
 #include "qgrpcstream.h"
 #include "qabstractgrpcclient.h"
@@ -204,7 +204,7 @@ QGrpcChannelPrivate::~QGrpcChannelPrivate()
 {
 }
 
-void QGrpcChannelPrivate::call(const QString &method, const QString &service, const QByteArray &args, QGrpcAsyncReply *reply)
+void QGrpcChannelPrivate::call(const QString &method, const QString &service, const QByteArray &args, QGrpcCallReply *reply)
 {
     QString rpcName = QString("/%1/%2").arg(service).arg(method);
 
@@ -230,7 +230,7 @@ void QGrpcChannelPrivate::call(const QString &method, const QString &service, co
         QObject::disconnect(*abortConnection);
     });
 
-    *abortConnection = QObject::connect(reply, &QGrpcAsyncReply::error, call.get(), [call, connection, abortConnection](const QGrpcStatus &status){
+    *abortConnection = QObject::connect(reply, &QGrpcCallReply::error, call.get(), [call, connection, abortConnection](const QGrpcStatus &status){
         if (status.code() == QGrpcStatus::Aborted) {
             QObject::disconnect(*connection);
             QObject::disconnect(*abortConnection);
@@ -330,7 +330,7 @@ QGrpcStatus QGrpcChannel::call(const QString &method, const QString &service, co
     return dPtr->call(method, service, args, ret);
 }
 
-void QGrpcChannel::call(const QString &method, const QString &service, const QByteArray &args, QGrpcAsyncReply *reply)
+void QGrpcChannel::call(const QString &method, const QString &service, const QByteArray &args, QGrpcCallReply *reply)
 {
     dPtr->call(method, service, args, reply);
 }

+ 1 - 1
src/grpc/qgrpcchannel.h

@@ -57,7 +57,7 @@ public:
     ~QGrpcChannel();
 
     QGrpcStatus call(const QString &method, const QString &service, const QByteArray &args, QByteArray &ret) override;
-    void call(const QString &method, const QString &service, const QByteArray &args, QtProtobuf::QGrpcAsyncReply *reply) override;
+    void call(const QString &method, const QString &service, const QByteArray &args, QtProtobuf::QGrpcCallReply *reply) override;
     void stream(QGrpcStream *stream, const QString &service, QAbstractGrpcClient *client) override;
     std::shared_ptr<QAbstractProtobufSerializer> serializer() const override;
 

+ 2 - 2
src/grpc/qgrpcchannel_p.h

@@ -33,7 +33,7 @@
 #include <grpcpp/security/credentials.h>
 
 #include "qabstractgrpccredentials.h"
-#include "qgrpcasyncreply.h"
+#include "qgrpccallreply.h"
 #include "qgrpcstream.h"
 #include "qabstractgrpcclient.h"
 #include "qgrpccredentials.h"
@@ -99,7 +99,7 @@ struct QGrpcChannelPrivate {
     QGrpcChannelPrivate(const QUrl &url, std::shared_ptr<grpc::ChannelCredentials> credentials);
     ~QGrpcChannelPrivate();
 
-    void call(const QString &method, const QString &service, const QByteArray &args, QGrpcAsyncReply *reply);
+    void call(const QString &method, const QString &service, const QByteArray &args, QGrpcCallReply *reply);
     QGrpcStatus call(const QString &method, const QString &service, const QByteArray &args, QByteArray &ret);
     void stream(QGrpcStream *stream, const QString &service, QAbstractGrpcClient *client);
 };

+ 3 - 3
src/grpc/qgrpchttp2channel.cpp

@@ -36,7 +36,7 @@
 
 #include <unordered_map>
 
-#include "qgrpcasyncreply.h"
+#include "qgrpccallreply.h"
 #include "qgrpcstream.h"
 #include "qabstractgrpcclient.h"
 #include "qgrpccredentials.h"
@@ -228,7 +228,7 @@ QGrpcStatus QGrpcHttp2Channel::call(const QString &method, const QString &servic
     return {grpcStatus, QString::fromUtf8(networkReply->rawHeader(GrpcStatusMessage))};
 }
 
-void QGrpcHttp2Channel::call(const QString &method, const QString &service, const QByteArray &args, QGrpcAsyncReply *reply)
+void QGrpcHttp2Channel::call(const QString &method, const QString &service, const QByteArray &args, QGrpcCallReply *reply)
 {
     assert(reply != nullptr);
     QNetworkReply *networkReply = dPtr->post(method, service, args);
@@ -256,7 +256,7 @@ void QGrpcHttp2Channel::call(const QString &method, const QString &service, cons
         networkReply->deleteLater();
     });
 
-    *abortConnection = QObject::connect(reply, &QGrpcAsyncReply::error, networkReply, [networkReply, connection, abortConnection] (const QGrpcStatus &status) {
+    *abortConnection = QObject::connect(reply, &QGrpcCallReply::error, networkReply, [networkReply, connection, abortConnection] (const QGrpcStatus &status) {
         if (status.code() == QGrpcStatus::Aborted) {
             if (*connection) {
                 QObject::disconnect(*connection);

+ 1 - 1
src/grpc/qgrpchttp2channel.h

@@ -56,7 +56,7 @@ public:
     ~QGrpcHttp2Channel();
 
     QGrpcStatus call(const QString &method, const QString &service, const QByteArray &args, QByteArray &ret) override;
-    void call(const QString &method, const QString &service, const QByteArray &args, QtProtobuf::QGrpcAsyncReply *reply) override;
+    void call(const QString &method, const QString &service, const QByteArray &args, QtProtobuf::QGrpcCallReply *reply) override;
     void stream(QGrpcStream *stream, const QString &service, QAbstractGrpcClient *client) override;
     std::shared_ptr<QAbstractProtobufSerializer> serializer() const override;
 private:

+ 2 - 2
src/grpc/qtgrpcglobal.h

@@ -66,8 +66,8 @@
 #include <memory>
 
 namespace QtProtobuf {
-class QGrpcAsyncReply;
+class QGrpcCallReply;
 class QGrpcStream;
-using QGrpcAsyncReplyShared = std::shared_ptr<QGrpcAsyncReply>;
+using QGrpcCallReplyShared = std::shared_ptr<QGrpcCallReply>;
 using QGrpcStreamShared = std::shared_ptr<QGrpcStream>;
 }

+ 18 - 18
tests/test_grpc/clienttest.cpp

@@ -106,7 +106,7 @@ TEST_F(ClientTest, CheckMethodsGeneration)
     QPointer<SimpleStringMessage> result(new SimpleStringMessage);
     testClient.testMethod(request, result);
     testClient.testMethod(request);
-    testClient.testMethod(request, &testClient, [](QGrpcAsyncReplyShared) {});
+    testClient.testMethod(request, &testClient, [](QGrpcCallReplyShared) {});
     delete result;
 }
 
@@ -130,8 +130,8 @@ TEST_P(ClientTest, StringEchoAsyncTest)
     request.setTestFieldString("Hello beach!");
     QEventLoop waiter;
 
-    QGrpcAsyncReplyShared reply = testClient->testMethod(request);
-    QObject::connect(reply.get(), &QGrpcAsyncReply::finished, &m_app, [reply, &result, &waiter]() {
+    QGrpcCallReplyShared reply = testClient->testMethod(request);
+    QObject::connect(reply.get(), &QGrpcCallReply::finished, &m_app, [reply, &result, &waiter]() {
         result = reply->read<SimpleStringMessage>();
         reply->deleteLater();
         waiter.quit();
@@ -149,7 +149,7 @@ TEST_P(ClientTest, StringEchoAsync2Test)
     SimpleStringMessage request;
     request.setTestFieldString("Hello beach!");
     QEventLoop waiter;
-    testClient->testMethod(request, &m_app, [&result, &waiter](QGrpcAsyncReplyShared reply) {
+    testClient->testMethod(request, &m_app, [&result, &waiter](QGrpcCallReplyShared reply) {
         result = reply->read<SimpleStringMessage>();
         waiter.quit();
     });
@@ -167,17 +167,17 @@ TEST_P(ClientTest, StringEchoImmediateAsyncAbortTest)
     SimpleStringMessage request;
     request.setTestFieldString("sleep");
     QEventLoop waiter;
-    QGrpcAsyncReplyShared reply = testClient->testMethod(request);
+    QGrpcCallReplyShared reply = testClient->testMethod(request);
 
     result.setTestFieldString("Result not changed by echo");
-    QObject::connect(reply.get(), &QGrpcAsyncReply::finished, &m_app, [&waiter, &result, reply]() {
+    QObject::connect(reply.get(), &QGrpcCallReply::finished, &m_app, [&waiter, &result, reply]() {
         result = reply->read<SimpleStringMessage>();
         reply->deleteLater();
         waiter.quit();
     });
 
     QGrpcStatus::StatusCode asyncStatus = QGrpcStatus::StatusCode::Ok;
-    QObject::connect(reply.get(), &QGrpcAsyncReply::error, [&asyncStatus](const QGrpcStatus &status) {
+    QObject::connect(reply.get(), &QGrpcCallReply::error, [&asyncStatus](const QGrpcStatus &status) {
         asyncStatus = status.code();
     });
 
@@ -204,20 +204,20 @@ TEST_P(ClientTest, StringEchoDeferredAsyncAbortTest)
     SimpleStringMessage request;
     request.setTestFieldString("sleep");
     QEventLoop waiter;
-    QGrpcAsyncReplyShared reply = testClient->testMethod(request);
+    QGrpcCallReplyShared reply = testClient->testMethod(request);
 
     result.setTestFieldString("Result not changed by echo");
     bool errorCalled = false;
     reply = testClient->testMethod(request);
-    QObject::connect(reply.get(), &QGrpcAsyncReply::finished, &m_app, [reply, &result, &waiter]() {
+    QObject::connect(reply.get(), &QGrpcCallReply::finished, &m_app, [reply, &result, &waiter]() {
         result = reply->read<SimpleStringMessage>();
         waiter.quit();
     });
-    QObject::connect(reply.get(), &QGrpcAsyncReply::error, [&errorCalled]() {
+    QObject::connect(reply.get(), &QGrpcCallReply::error, [&errorCalled]() {
         errorCalled = true;
     });
 
-    QTimer::singleShot(500, reply.get(), &QGrpcAsyncReply::abort);
+    QTimer::singleShot(500, reply.get(), &QGrpcCallReply::abort);
     QTimer::singleShot(5000, &waiter, &QEventLoop::quit);
 
     waiter.exec();
@@ -397,8 +397,8 @@ TEST_P(ClientTest, StatusMessageAsyncTest)
     QEventLoop waiter;
     QString statusMessage;
 
-    QGrpcAsyncReplyShared reply = testClient->testMethodStatusMessage(request);
-    QObject::connect(reply.get(), &QGrpcAsyncReply::error, [&asyncStatus, &waiter, &statusMessage](const QGrpcStatus &status) {
+    QGrpcCallReplyShared reply = testClient->testMethodStatusMessage(request);
+    QObject::connect(reply.get(), &QGrpcCallReply::error, [&asyncStatus, &waiter, &statusMessage](const QGrpcStatus &status) {
         asyncStatus = status.code();
         statusMessage = status.message();
         waiter.quit();
@@ -523,7 +523,7 @@ TEST_P(ClientTest, AsyncReplyStreamTest)
     callTimeout.setInterval(5000);
     auto reply = testClient->testMethodStatusMessage(request);
 
-    reply->stream(&m_app, []() {
+    reply->subscribe(&m_app, []() {
         ASSERT_TRUE(false);
     },
     [&asyncStatus, &waiter, &statusMessage](const QGrpcStatus &status) {
@@ -542,7 +542,7 @@ TEST_P(ClientTest, AsyncReplyStreamTest)
     request.setTestFieldString("Hello beach!");
 
     reply = testClient->testMethod(request);
-    reply->stream(&m_app, [reply, &result, &waiter]() {
+    reply->subscribe(&m_app, [reply, &result, &waiter]() {
         result = reply->read<SimpleStringMessage>();
         waiter.quit();
     });
@@ -556,7 +556,7 @@ TEST_P(ClientTest, AsyncReplyStreamTest)
     request.setTestFieldString("Hello beach1!");
 
     reply = testClient->testMethod(request);
-    reply->stream(&m_app, [reply, &result, &waiter]() {
+    reply->subscribe(&m_app, [reply, &result, &waiter]() {
         result = reply->read<SimpleStringMessage>();
         waiter.quit();
     }, []() {
@@ -710,9 +710,9 @@ TEST_P(ClientTest, StringEchoAsyncThreadTest)
     std::shared_ptr<QThread> thread(QThread::create([&](){
         QEventLoop waiter;
         QThread *validThread = QThread::currentThread();
-        QGrpcAsyncReplyShared reply = testClient->testMethod(request);
+        QGrpcCallReplyShared reply = testClient->testMethod(request);
         QObject::connect(reply.get(), &QObject::destroyed, [&replyDestroyed]{replyDestroyed = true;});
-        QObject::connect(reply.get(), &QGrpcAsyncReply::finished, &waiter, [reply, &result, &waiter, &threadsOk, validThread]() {
+        QObject::connect(reply.get(), &QGrpcCallReply::finished, &waiter, [reply, &result, &waiter, &threadsOk, validThread]() {
             threadsOk &= reply->thread() != QThread::currentThread();
             threadsOk &= validThread == QThread::currentThread();
             result = reply->read<SimpleStringMessage>();

+ 2 - 1
tests/test_qttypes/qtguitest.cpp

@@ -86,7 +86,8 @@ TEST_F(QtTypesQtGuiTest, QMatrix4x4Test)
     EXPECT_TRUE(QByteArray::fromHex("0a518501000070417d0000604175000050416d0000404165000030415d0000204155000010414d00000041450000e0403d0000c040350000a0402d0000804025000040401d00000040150000803f0d00000000") == result
                 || QByteArray::fromHex("0a4c150000803f1d0000004025000040402d00008040350000a0403d0000c040450000e0404d0000004155000010415d0000204165000030416d0000404175000050417d00006041850100007041") == result
                 || QByteArray::fromHex("0a514d000000410d00000000150000803f1d0000004025000040402d00008040350000a0403d0000c040450000e04055000010415d0000204165000030416d0000404175000050417d00006041850100007041") == result
-                || QByteArray::fromHex("0a510d00000000150000803f1d0000004025000040402d00008040350000a0403d0000c040450000e0404d0000004155000010415d0000204165000030416d0000404175000050417d00006041850100007041") == result);
+                || QByteArray::fromHex("0a510d00000000150000803f1d0000004025000040402d00008040350000a0403d0000c040450000e0404d0000004155000010415d0000204165000030416d0000404175000050417d00006041850100007041") == result
+                || QByteArray::fromHex("0a518501000070417d0000604175000050410d00000000150000803f1d0000004025000040402d00008040350000a0403d0000c040450000e0404d0000004155000010415d0000204165000030416d00004041") == result);
 
     msg.setTestField({});
     msg.deserialize(serializer.get(), QByteArray::fromHex("0a4c150000803f1d0000004025000040402d00008040350000a0403d0000c040450000e0404d0000004155000010415d0000204165000030416d0000404175000050417d00006041850100007041"));