whoopsies
This commit is contained in:
parent
6dcc10093f
commit
330088f55d
2 changed files with 16 additions and 4 deletions
4
dev_in.c
4
dev_in.c
|
|
@ -454,7 +454,7 @@ void* dev_in_thread_func(void *ptr) {
|
|||
if (dev_in_data->communication.type == ipc_unix_pipe) {
|
||||
out_message_fd = dev_in_data->communication.endpoint.pipe.out_message_pipe_fd;
|
||||
} else if (dev_in_data->communication.type == ipc_client_socket) {
|
||||
|
||||
out_message_fd = dev_in_data->communication.endpoint.socket.fd;
|
||||
}
|
||||
|
||||
if (FD_ISSET(out_message_fd, &read_fds)) {
|
||||
|
|
@ -546,7 +546,7 @@ void* dev_in_thread_func(void *ptr) {
|
|||
in_message_fd = dev_in_data->communication.endpoint.pipe.in_message_pipe_fd;
|
||||
}
|
||||
|
||||
const int write_res = write(in_message_fd, (void*)&controller_msg[0], controller_msg_count);
|
||||
const int write_res = write(in_message_fd, (void*)&controller_msg[0], sizeof(in_message_t) * controller_msg_count);
|
||||
if (write_res < 0) {
|
||||
fprintf(stderr, "Error in writing input event messages: %d\n", write_res);
|
||||
|
||||
|
|
|
|||
16
dev_out.c
16
dev_out.c
|
|
@ -306,10 +306,22 @@ void *dev_out_thread_func(void *ptr) {
|
|||
|
||||
// send out game-generated events to sockets
|
||||
int fd = -1;
|
||||
const size_t bytes_to_send = sizeof(out_message_t) * out_msgs_count;
|
||||
|
||||
if (dev_out->communication.type == ipc_unix_pipe) {
|
||||
fd = dev_out->communication.endpoint.pipe.out_message_pipe_fd;
|
||||
const int write_res = write(dev_out->communication.endpoint.pipe.out_message_pipe_fd, (void*)&out_msgs, bytes_to_send);
|
||||
if (write_res != bytes_to_send) {
|
||||
fprintf(stderr, "Error in writing out_message to out_message_pipe: %d\n", write_res);
|
||||
}
|
||||
} else if (dev_out->communication.type == ipc_server_sockets) {
|
||||
|
||||
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);
|
||||
if (write_res != bytes_to_send) {
|
||||
fprintf(stderr, "Error in writing out_message to socket number %d: %d\n", i, write_res);
|
||||
close(dev_out->communication.endpoint.ssocket.clients[i]);
|
||||
dev_out->communication.endpoint.ssocket.clients[i] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue