单例接口放置在cpp文件中

This commit is contained in:
xiongziliang
2018-07-03 17:10:11 +08:00
parent 35fd682c9a
commit b7304808b3
4 changed files with 18 additions and 11 deletions

View File

@@ -47,13 +47,9 @@ public:
typedef function< bool(int, const Buffer::Ptr &, struct sockaddr *)> onRecvData;
UDPServer();
virtual ~UDPServer();
static UDPServer &Instance() {
static UDPServer *instance(new UDPServer());
return *instance;
}
static void Destory() {
delete &UDPServer::Instance();
}
static UDPServer &Instance();
static void Destory();
Socket::Ptr getSock(const char *strLocalIp, int iTrackIndex,uint16_t iLocalPort = 0);
void listenPeer(const char *strPeerIp, void *pSelf, const onRecvData &cb);
void stopListenPeer(const char *strPeerIp, void *pSelf);