bugs...
This commit is contained in:
parent
330088f55d
commit
385301f5cf
2 changed files with 12 additions and 8 deletions
|
|
@ -314,6 +314,7 @@ void *dev_out_thread_func(void *ptr) {
|
||||||
fprintf(stderr, "Error in writing out_message to out_message_pipe: %d\n", write_res);
|
fprintf(stderr, "Error in writing out_message to out_message_pipe: %d\n", write_res);
|
||||||
}
|
}
|
||||||
} else if (dev_out->communication.type == ipc_server_sockets) {
|
} else if (dev_out->communication.type == ipc_server_sockets) {
|
||||||
|
if (pthread_mutex_lock(&dev_out->communication.endpoint.ssocket.mutex) == 0) {
|
||||||
for (int i = 0; i < MAX_CONNECTED_CLIENTS; ++i) {
|
for (int i = 0; i < MAX_CONNECTED_CLIENTS; ++i) {
|
||||||
const int write_res = write(dev_out->communication.endpoint.ssocket.clients[i], (void*)&out_msgs, bytes_to_send);
|
const int write_res = write(dev_out->communication.endpoint.ssocket.clients[i], (void*)&out_msgs, bytes_to_send);
|
||||||
if (write_res != bytes_to_send) {
|
if (write_res != bytes_to_send) {
|
||||||
|
|
@ -322,6 +323,9 @@ void *dev_out_thread_func(void *ptr) {
|
||||||
dev_out->communication.endpoint.ssocket.clients[i] = -1;
|
dev_out->communication.endpoint.ssocket.clients[i] = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pthread_mutex_unlock(&dev_out->communication.endpoint.ssocket.mutex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -347,8 +351,8 @@ void *dev_out_thread_func(void *ptr) {
|
||||||
handle_incoming_message(&incoming_message, &dev_out->dev_stats);
|
handle_incoming_message(&incoming_message, &dev_out->dev_stats);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Error reading from in_message_pipe_fd: got %zu bytes, expected %zu butes\n", in_message_pipe_read_res, sizeof(in_message_t));
|
fprintf(stderr, "Error reading from in_message_pipe_fd: got %zu bytes, expected %zu butes\n", in_message_pipe_read_res, sizeof(in_message_t));
|
||||||
|
close(dev_out->communication.endpoint.ssocket.clients[i]);
|
||||||
dev_out->communication.endpoint.ssocket.clients[i] = -1;
|
dev_out->communication.endpoint.ssocket.clients[i] = -1;
|
||||||
close(fd);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ int main(int argc, char ** argv) {
|
||||||
if (pthread_mutex_lock(&dev_out_thread_data.communication.endpoint.ssocket.mutex) == 0) {
|
if (pthread_mutex_lock(&dev_out_thread_data.communication.endpoint.ssocket.mutex) == 0) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < MAX_CONNECTED_CLIENTS; ++i) {
|
for (i = 0; i < MAX_CONNECTED_CLIENTS; ++i) {
|
||||||
if (dev_out_thread_data.communication.endpoint.ssocket.clients[i] == -1) {
|
if (dev_out_thread_data.communication.endpoint.ssocket.clients[i] < 0) {
|
||||||
dev_out_thread_data.communication.endpoint.ssocket.clients[i] = client_fd;
|
dev_out_thread_data.communication.endpoint.ssocket.clients[i] = client_fd;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue