Make message poll wait indefinitely

refactor
PgSocks 2 years ago
parent 0699fa5906
commit 51b8897d38

@ -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);
}

Loading…
Cancel
Save