mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Do not create a new socket if the max. number of clients is attained
Fixes coverity issue 23431.
This commit is contained in:
parent
3db4b23b3f
commit
4a439d6ac0
@ -97,6 +97,11 @@ string const ServerSocket::address() const
|
||||
// is OK and if the number of clients does not exceed MAX_CLIENTS
|
||||
void ServerSocket::serverCallback()
|
||||
{
|
||||
if (clients.size() >= MAX_CLIENTS) {
|
||||
writeln("BYE:Too many clients connected");
|
||||
return;
|
||||
}
|
||||
|
||||
int const client_fd = socktools::accept(fd_);
|
||||
|
||||
if (fd_ == -1) {
|
||||
@ -104,11 +109,6 @@ void ServerSocket::serverCallback()
|
||||
return;
|
||||
}
|
||||
|
||||
if (clients.size() >= MAX_CLIENTS) {
|
||||
writeln("BYE:Too many clients connected");
|
||||
return;
|
||||
}
|
||||
|
||||
// Register the new client.
|
||||
clients[client_fd] =
|
||||
shared_ptr<LyXDataSocket>(new LyXDataSocket(client_fd));
|
||||
|
Loading…
Reference in New Issue
Block a user