#pragma once #include #include namespace a8 { struct UdpPacket; } struct MsgNode; struct UdpMsgNode; class App : public a8::Singleton, public f8::UserApp { private: App() {}; friend class a8::Singleton; public: virtual const std::string GetPkgName() override; virtual void Init() override; virtual void UnInit() override; virtual void Update() override; virtual bool HasTask() override; virtual void DispatchSocketMsg(f8::MsgHdr* hdr) override; void AddUdpMsg(a8::UdpPacket* pkt); PerfMonitor& GetPerf() { return perf_; } int GetMsgNodeSize() { return msgnode_size_;} int GetUdpMsgNodeSize() { return udp_msgnode_size_;} int GetGameId() const; private: void QuickExecute(); void SlowerExecute(); void DispatchUdpMsg(); void ProcessClientMsg(f8::MsgHdr* hdr, int tag); void ProcessMasterServerMsg(f8::MsgHdr* hdr, int tag); void ProcessTargetServerMsg(f8::MsgHdr* hdr, int tag); void FreeUdpMsgQueue(); private: PerfMonitor perf_; std::mutex* udp_msg_mutex_ = nullptr; UdpMsgNode* udp_top_node_ = nullptr; UdpMsgNode* udp_bot_node_ = nullptr; UdpMsgNode* udp_work_node_ = nullptr; int msgnode_size_ = 0 ; int udp_msgnode_size_ = 0 ; int working_msgnode_size_ = 0; int udp_working_msgnode_size_ = 0; };