|
楼主 |
发表于 2008-9-10 23:02:08
|
显示全部楼层
我的 P2P_Task_CDN_PrgmAgent task 类 svc 方法中不能访问到我的成员变量- class P2P_Task_CDN_PrgmAgent : public P2P_Task_Base
- {
- private:
- std::string m_transactionip;
- unsigned int m_transactionport;
- std::map<std::string,unsigned int> m_esaddrport;
- ACE_Recursive_Thread_Mutex recursive_mutex_; // 锁
- public:
- P2P_Task_CDN_PrgmAgent(P2P_Application * pApplication,UInt32 taskid);
- virtual ~P2P_Task_CDN_PrgmAgent(void);
- virtual bool Initialize()
- {
- return true;
- }
- void get_all_interfaces();
- virtual int svc();
- bool SendFileToEs();
- bool ProcessMessage(P2P_Message_Base *pMsg,
- ACE_Message_Block *pCurrentMessageBlock);
- };
- int P2P_Task_CDN_PrgmAgent:pen()
- {
- m_transactionip = "127.0.0.1";
- m_transactionport = 8888;
- }
- int P2P_Task_CDN_PrgmAgent::svc()
- {
- while(1)
- {
- ACE_Message_Block * pMessage = 0;
- P2P_Message_Base * pMsg = 0;
- {
- ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, guard, recursive_mutex_,0);
- this->getq(pMessage);
- assert(pMessage);
- pMsg = P2P_Message_Base:eserialize(pMessage->base());
- pMessage->release();
- }
- assert(pMsg);
- char addr[20];
- memset(addr,0,sizeof(addr));
- ACE_OS::inet_ntop(AF_INET,&pMsg->uiParameter1,addr,sizeof(addr));
- ACE_DEBUG((LM_DEBUG,"drive ES:%p%s",addr));
- //怪异的是下一行,总是不能得到 m_transactionip 的值,每次都是 ""
- int ret = TransFile("c:\\twz.mp4",addr,
- pMsg->uiParameter2,m_transactionip,m_transactionport);
- }
- return 0;
- }
复制代码 |
|