示例#1
0
   void _omManager::_sendRes2Agent( NET_HANDLE handle, MsgHeader *pSrcMsg, 
                                    INT32 flag, rtnContextBuf &buffObj )
   {

      MsgOpReply reply ;
      INT32 rc                   = SDB_OK ;
      const CHAR *pBody          = buffObj.data() ;
      INT32 bodyLen              = buffObj.size() ;
      reply.header.messageLength = sizeof( MsgOpReply ) + bodyLen ;
      reply.header.opCode        = MAKE_REPLY_TYPE( pSrcMsg->opCode ) ;
      reply.header.TID           = pSrcMsg->TID ;
      reply.header.routeID.value = 0 ;
      reply.header.requestID     = pSrcMsg->requestID ;
      reply.contextID            = -1 ;
      reply.flags                = flag ;
      reply.startFrom            = 0 ;
      reply.numReturned          = buffObj.recordNum() ;

      if ( bodyLen > 0 )
      {
         rc = _netAgent.syncSend ( handle, (MsgHeader *)( &reply ),
                                   (void*)pBody, bodyLen ) ;
      }
      else
      {
         rc = _netAgent.syncSend ( handle, (void *)( &reply ) ) ;
      }

      if ( rc != SDB_OK )
      {
         PD_LOG ( PDERROR, "send response to agent failed:rc=%d", rc ) ;
      }
   }