创建Socket优先绑定本线程

This commit is contained in:
xiongziliang
2019-05-31 18:01:38 +08:00
parent f2e4eac5ef
commit c0f41167ba
7 changed files with 11 additions and 11 deletions

View File

@@ -41,12 +41,12 @@ UDPServer::~UDPServer() {
InfoL;
}
Socket::Ptr UDPServer::getSock(const char* strLocalIp, int intervaled,uint16_t iLocalPort) {
Socket::Ptr UDPServer::getSock(const EventPoller::Ptr &poller,const char* strLocalIp, int intervaled,uint16_t iLocalPort) {
lock_guard<mutex> lck(_mtxUpdSock);
string strKey = StrPrinter << strLocalIp << ":" << intervaled << endl;
auto it = _mapUpdSock.find(strKey);
if (it == _mapUpdSock.end()) {
Socket::Ptr pSock(new Socket());
Socket::Ptr pSock(new Socket(poller));
//InfoL<<localIp;
if (!pSock->bindUdpSock(iLocalPort, strLocalIp)) {
//分配失败