diff --git a/examples/CustomDemo/CustomClient/main.cpp b/examples/CustomDemo/CustomClient/main.cpp index 3ae78fc..41fcdc1 100644 --- a/examples/CustomDemo/CustomClient/main.cpp +++ b/examples/CustomDemo/CustomClient/main.cpp @@ -80,11 +80,13 @@ public: virtual int onDispatchResponse(const RequestPacket &req, const ResponsePacket &rsp) { cout << "async response:" << rsp.sBuffer.data() << endl; + return 0; } virtual int onDispatchException(const RequestPacket &req, const ResponsePacket &rsp) { cout << "async exception:" << rsp.iRet << endl; + return 0; } }; diff --git a/examples/QuickStartDemo/HelloServer/Client/main.cpp b/examples/QuickStartDemo/HelloServer/Client/main.cpp index 99063f1..92279ce 100644 --- a/examples/QuickStartDemo/HelloServer/Client/main.cpp +++ b/examples/QuickStartDemo/HelloServer/Client/main.cpp @@ -165,6 +165,9 @@ void syncTupCall(int c) int ret = rsp.get(""); string sRsp = rsp.get("sRsp"); + + // assert(ret == 0); + // assert(sRsp == buffer); } catch(exception& e) { diff --git a/servant/libservant/TarsCurrent.cpp b/servant/libservant/TarsCurrent.cpp index b9cb4e9..f071b9e 100644 --- a/servant/libservant/TarsCurrent.cpp +++ b/servant/libservant/TarsCurrent.cpp @@ -258,7 +258,7 @@ void TarsCurrent::sendResponse(const char* buff, uint32_t len) } -void TarsCurrent::sendResponse(int iRet, const vector &buff, bool push) +void TarsCurrent::sendResponse(int iRet, const vector &buff) { //单向调用不需要返回 if (_request.cPacketType == TARSONEWAY) @@ -268,35 +268,35 @@ void TarsCurrent::sendResponse(int iRet, const vector &buff, bool push) // ResponsePacket response; // response.sBuffer = buff; - sendResponse(iRet, buff, TARS_STATUS(), "", push); + sendResponse(iRet, buff, TARS_STATUS(), ""); } void TarsCurrent::sendResponse(int iRet) { // ResponsePacket response; - sendResponse(iRet, vector(), TARS_STATUS(), "", false); + sendResponse(iRet, vector(), TARS_STATUS(), ""); } -void TarsCurrent::sendResponse(int iRet, tars::TarsOutputStream& os, bool push) +void TarsCurrent::sendResponse(int iRet, tars::TarsOutputStream& os) { // ResponsePacket response; // os.swap(response.sBuffer); - sendResponse(iRet, os.getByteBuffer(), TARS_STATUS(), "", push); + sendResponse(iRet, os.getByteBuffer(), TARS_STATUS(), ""); } -void TarsCurrent::sendResponse(int iRet, tup::UniAttribute& attr, bool push) +void TarsCurrent::sendResponse(int iRet, tup::UniAttribute& attr) { ResponsePacket response; attr.encode(response.sBuffer); - sendResponse(iRet, response.sBuffer, TARS_STATUS(), "", push); + sendResponse(iRet, response.sBuffer, TARS_STATUS(), ""); } -void TarsCurrent::sendResponse(int iRet, const vector &buffer, const map& status, const string & sResultDesc, bool push) +void TarsCurrent::sendResponse(int iRet, const vector &buffer, const map& status, const string & sResultDesc) { _ret = iRet; //单向调用不需要返回 - if (_request.cPacketType == TARSONEWAY && !push) + if (_request.cPacketType == TARSONEWAY) { return; } @@ -318,14 +318,7 @@ void TarsCurrent::sendResponse(int iRet, const vector &buffer, const map< response.iRequestId = _request.iRequestId; response.iMessageType = _request.iMessageType; - if(push) - { - response.cPacketType = TARSPUSH; - } - else - { - response.cPacketType = TARSNORMAL; - } + response.cPacketType = TARSNORMAL; response.iVersion = _request.iVersion; response.status = status; @@ -349,14 +342,7 @@ void TarsCurrent::sendResponse(int iRet, const vector &buffer, const map< response.iRequestId = _request.iRequestId; response.iMessageType = _request.iMessageType; - if(push) - { - response.cPacketType = TARSPUSH; - } - else - { - response.cPacketType = TARSNORMAL; - } + response.cPacketType = TARSNORMAL; response.iVersion = _request.iVersion; response.status = status; diff --git a/servant/servant/TarsCurrent.h b/servant/servant/TarsCurrent.h index 16ed790..5061efc 100644 --- a/servant/servant/TarsCurrent.h +++ b/servant/servant/TarsCurrent.h @@ -199,7 +199,7 @@ public: * @param status * @param buffer */ - void sendResponse(int iRet, tars::TarsOutputStream& os, bool push = false); + void sendResponse(int iRet, tars::TarsOutputStream& os); /** * taf协议的发送响应数据(仅TAF协议有效), 直接swapbuffer , 这样可以不用copy 数据 @@ -207,14 +207,14 @@ public: * @param status * @param buffer */ - void sendResponse(int iRet, tup::UniAttribute& attr, bool push = false); + void sendResponse(int iRet, tup::UniAttribute& attr); /** * taf协议的发送响应数据(仅TAF协议有效) * @param iRet * @param buff */ - void sendResponse(int iRet, const vector &buff, bool push = false); + void sendResponse(int iRet, const vector &buff); /** * 普通协议的发送响应数据(非TAF协议有效) @@ -287,7 +287,7 @@ protected: * @param sResultDesc * @param push */ - void sendResponse(int iRet, const vector &buffer, const map& status, const string& sResultDesc, bool push = false); + void sendResponse(int iRet, const vector &buffer, const map& status, const string& sResultDesc); protected: /** diff --git a/util/src/tc_timeprovider.cpp b/util/src/tc_timeprovider.cpp index e4a1c35..e035e53 100644 --- a/util/src/tc_timeprovider.cpp +++ b/util/src/tc_timeprovider.cpp @@ -15,6 +15,7 @@ */ #include "util/tc_timeprovider.h" +#include namespace tars {