我看不懂下面的代码。当reservedFd_ == -2时,表示接受了两个多客户端,为什么?非常感谢。
// In one function.
...
...
reservedFd_ = ::open("/dev/null", O_APPEND);
if (-1 == reservedFd_)
{
LOG_DEBUG("Failed to open reserved file!, errno: %d", errno);
}
...
...
...
----------------------------------------------------------------------
// then in other function we accept a new client socket
void TCPServer::HandleAccept( const boost::system::error_code& _err )
{
if (!_err)
{
// too many clients accepted? why?
if (-2 == reservedFd_)
{
boost::system::error_code ignored_ec;
session_->GetSocket().close(ignored_ec);
}
else
{
...
}
}
...
}