Make message poll wait indefinitely
This commit is contained in:
+3
-3
@@ -28,11 +28,11 @@ void client_connect(Client client) {
|
||||
void poll_message(Client client, union Message* resp) {
|
||||
|
||||
// Poll for messages
|
||||
static struct timeval timeout = {-1, 0};
|
||||
static struct timeval timeout = {0, 0};
|
||||
fd_set read_fds;
|
||||
FD_ZERO(&read_fds);
|
||||
FD_SET(client->connection->sockfd, &read_fds);
|
||||
int result = select(client->connection->sockfd + 1, &read_fds, NULL, NULL, &timeout);
|
||||
int result = select(client->connection->sockfd + 1, &read_fds, NULL, NULL, NULL);
|
||||
|
||||
// Check for socket polling errors
|
||||
if(result < 0) {
|
||||
@@ -57,7 +57,7 @@ void poll_message(Client client, union Message* resp) {
|
||||
}
|
||||
|
||||
// Check for message errors
|
||||
if(message_validate(resp)) {
|
||||
if(message_validate(resp) != MESSAGEERR_NONE) {
|
||||
perror("invalid message");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user