- bugs fixed

This commit is contained in:
Dmytro Bogovych 2018-07-22 22:19:04 +03:00
parent 9d31979db3
commit f94960ebbb
2 changed files with 183 additions and 179 deletions

View File

@ -219,9 +219,11 @@ void SocketHeap::processDeleted()
void SocketHeap::thread()
{
/*#ifdef __linux__
/*#ifdef __linux__
// TODO: make epoll implementation for massive polling
#else*/
mId = ThreadIf::selfId();
while (!isShutdown())
{
// Define socket agreggator
@ -237,11 +239,14 @@ void SocketHeap::thread()
}
// Update socket set
for (SocketMap::iterator socketIter = mSocketMap.begin(); socketIter != mSocketMap.end(); ++socketIter)
for (auto& socketIter: mSocketMap)
agreggator.addSocket(socketIter.second.mSocket);
/* for (SocketMap::iterator socketIter = mSocketMap.begin(); socketIter != mSocketMap.end(); ++socketIter)
{
// Add handle to set
agreggator.addSocket(socketIter->second.mSocket);
}
} */
}
// If set is not empty
@ -281,11 +286,11 @@ void SocketHeap::thread()
}
}
else
SyncHelper::delay(1000); // Delay for 1 millisecond
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
mId = 0;
mShutdown = false;
//#endif
//#endif
}

View File

@ -103,10 +103,9 @@ protected:
Mutex mDeleteGuard;
char mTempPacket[MAX_UDPPACKET_SIZE];
volatile bool mShutdown = false;
int mId = 0;
bool isShutdown() const { return mShutdown; }
//bool isShutdown() const { return mShutdown; }
virtual void thread();
// Processes mDeleteVector -> updates mSocketMap, removes socket items and closes sockets specified in mDeleteVector