Fixed crash in SocketSelector::add when passing an invalid socket
This commit is contained in:
parent
5706111088
commit
aa534a0936
2 changed files with 10 additions and 5 deletions
|
@ -73,11 +73,15 @@ SocketSelector::~SocketSelector()
|
|||
////////////////////////////////////////////////////////////
|
||||
void SocketSelector::add(Socket& socket)
|
||||
{
|
||||
FD_SET(socket.getHandle(), &m_impl->AllSockets);
|
||||
SocketHandle handle = socket.getHandle();
|
||||
if (handle != SocketImpl::invalidSocket())
|
||||
{
|
||||
FD_SET(handle, &m_impl->AllSockets);
|
||||
|
||||
int size = static_cast<int>(socket.getHandle());
|
||||
if (size > m_impl->MaxSocket)
|
||||
m_impl->MaxSocket = size;
|
||||
int size = static_cast<int>(handle);
|
||||
if (size > m_impl->MaxSocket)
|
||||
m_impl->MaxSocket = size;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue