diff --git a/libshvchainpack/include/shv/chainpack/rpcdriver.h b/libshvchainpack/include/shv/chainpack/rpcdriver.h index 4b9817b8..f0323a23 100644 --- a/libshvchainpack/include/shv/chainpack/rpcdriver.h +++ b/libshvchainpack/include/shv/chainpack/rpcdriver.h @@ -26,7 +26,7 @@ class SHVCHAINPACK_DECL_EXPORT RpcDriver protected: virtual bool isOpen() = 0; - virtual void writeFrame(RpcFrame &&frame) = 0; + virtual void writeFrame(const RpcFrame &frame) = 0; void processRpcFrame(RpcFrame &&frame); virtual void onRpcFrameReceived(RpcFrame &&frame); diff --git a/libshvchainpack/include/shv/chainpack/socketrpcdriver.h b/libshvchainpack/include/shv/chainpack/socketrpcdriver.h index 48aaa2ab..2df62c4c 100644 --- a/libshvchainpack/include/shv/chainpack/socketrpcdriver.h +++ b/libshvchainpack/include/shv/chainpack/socketrpcdriver.h @@ -20,7 +20,7 @@ class SHVCHAINPACK_DECL_EXPORT SocketRpcDriver : public RpcDriver void sendNotify(std::string &&method, const RpcValue &result); protected: bool isOpen() override; - void writeFrame(RpcFrame &&frame) override; + void writeFrame(const RpcFrame &frame) override; virtual void onFrameDataRead(const std::string &frame_data); virtual void idleTaskOnSelectTimeout(); diff --git a/libshvchainpack/src/rpcdriver.cpp b/libshvchainpack/src/rpcdriver.cpp index d0c122e3..bba535ab 100644 --- a/libshvchainpack/src/rpcdriver.cpp +++ b/libshvchainpack/src/rpcdriver.cpp @@ -47,11 +47,11 @@ void RpcDriver::sendRpcFrame(RpcFrame &&frame) throw std::runtime_error("Cannot convert RPC frame to message: " + errmsg); } auto frame2 = msg.toRpcFrame(m_clientProtocolType); - writeFrame(std::move(frame2)); + writeFrame(frame2); } else { //logRpcData().nospace() << "FRAME DATA WRITE " << frame_data.size() << " bytes of data:\n" << shv::chainpack::utils::hexDump(frame_data); - writeFrame(std::move(frame)); + writeFrame(frame); } } catch (const std::exception &e) { diff --git a/libshvchainpack/src/socketrpcdriver.cpp b/libshvchainpack/src/socketrpcdriver.cpp index d59fc945..39aacc68 100644 --- a/libshvchainpack/src/socketrpcdriver.cpp +++ b/libshvchainpack/src/socketrpcdriver.cpp @@ -57,7 +57,7 @@ void SocketRpcDriver::idleTaskOnSelectTimeout() { } -void SocketRpcDriver::writeFrame(RpcFrame &&frame) +void SocketRpcDriver::writeFrame(const RpcFrame &frame) { if(!isOpen()) { nInfo() << "Write to closed socket"; diff --git a/libshviotqt/include/shv/iotqt/rpc/socketrpcconnection.h b/libshviotqt/include/shv/iotqt/rpc/socketrpcconnection.h index 563cf20c..90d47b6c 100644 --- a/libshviotqt/include/shv/iotqt/rpc/socketrpcconnection.h +++ b/libshviotqt/include/shv/iotqt/rpc/socketrpcconnection.h @@ -50,7 +50,7 @@ class SHVIOTQT_DECL_EXPORT SocketRpcConnection : public QObject, public shv::cha protected: // RpcDriver interface bool isOpen() Q_DECL_OVERRIDE; - void writeFrame(shv::chainpack::RpcFrame &&frame) override; + void writeFrame(const shv::chainpack::RpcFrame &frame) override; Socket* socket(); void onReadyRead(); diff --git a/libshviotqt/src/rpc/socket.cpp b/libshviotqt/src/rpc/socket.cpp index 9b61fbea..dfea5219 100644 --- a/libshviotqt/src/rpc/socket.cpp +++ b/libshviotqt/src/rpc/socket.cpp @@ -176,7 +176,7 @@ void StreamFrameWriter::addFrameData(const std::string &frame_head, const std::s std::ostringstream out; { ChainPackWriter wr(out); - wr.writeUIntData(frame_data.size()); + wr.writeUIntData(frame_head.size() + frame_data.size()); } auto len_data = out.str(); QByteArray data(len_data.data(), len_data.size()); diff --git a/libshviotqt/src/rpc/socketrpcconnection.cpp b/libshviotqt/src/rpc/socketrpcconnection.cpp index 57bf3ec6..b513342e 100644 --- a/libshviotqt/src/rpc/socketrpcconnection.cpp +++ b/libshviotqt/src/rpc/socketrpcconnection.cpp @@ -111,7 +111,7 @@ bool SocketRpcConnection::isOpen() return isSocketConnected(); } -void SocketRpcConnection::writeFrame(chainpack::RpcFrame &&frame) +void SocketRpcConnection::writeFrame(const chainpack::RpcFrame &frame) { socket()->writeFrame(frame); }