let me try a little something...

This commit is contained in:
Denis 2023-12-13 14:40:11 +01:00
parent 70023cb48f
commit 2ca8e9ada3
No known key found for this signature in database
GPG key ID: DD9B63F805CF5C03
2 changed files with 5 additions and 4 deletions

View file

@ -110,15 +110,16 @@ int main(int argc, char ** argv) {
// here the client_fd is good
if (pthread_mutex_lock(&dev_out_thread_data.communication.endpoint.ssocket.mutex) == 0) {
int i;
for (i = 0; i < MAX_CONNECTED_CLIENTS; ++i) {
bool found = false;
for (size_t i = 0; i < MAX_CONNECTED_CLIENTS; ++i) {
if (dev_out_thread_data.communication.endpoint.ssocket.clients[i] < 0) {
dev_out_thread_data.communication.endpoint.ssocket.clients[i] = client_fd;
found = true;
break;
}
}
if (i == MAX_CONNECTED_CLIENTS) {
if (!found) {
fprintf(stderr, "Could not find a free spot fot the incoming client -- client will be rejected\n");
close(client_fd);
}