Thrift之TProcess类体系原理及源码详细解析
2012-06-03 15:50:17 来源:WEB开发网核心提示:process函数定义如下:bool FacebookServiceProcessor::process(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot, boost::shared_ptr< ::apache::thr
process函数定义如下:
bool FacebookServiceProcessor::process(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot,
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot, void* callContext) {
::apache::thrift::protocol::TProtocol* iprot = piprot.get();
::apache::thrift::protocol::TProtocol* oprot = poprot.get();
std::string fname;
::apache::thrift::protocol::TMessageType mtype;
int32_t seqid;
iprot->readMessageBegin(fname, mtype, seqid);//读取得到函数名称、消息类型和函数序列号
//处理不是函数调用消息的情况
if (mtype != ::apache::thrift::protocol::T_CALL && mtype != ::apache::thrift::protocol::T_ONEWAY) {
iprot->skip(::apache::thrift::protocol::T_STRUCT);
更多精彩
赞助商链接