socket-proxyd: do not hardcode -1 in a check for fd validity

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2022-12-19 14:35:05 +01:00
parent 5ac1e0eff3
commit da850694a9

View File

@@ -234,15 +234,15 @@ static int traffic_cb(sd_event_source *s, int fd, uint32_t revents, void *userda
goto quit;
/* EOF on both sides? */
if (c->server_fd == -1 && c->client_fd == -1)
if (c->server_fd < 0 && c->client_fd < 0)
goto quit;
/* Server closed, and all data written to client? */
if (c->server_fd == -1 && c->server_to_client_buffer_full <= 0)
if (c->server_fd < 0 && c->server_to_client_buffer_full <= 0)
goto quit;
/* Client closed, and all data written to server? */
if (c->client_fd == -1 && c->client_to_server_buffer_full <= 0)
if (c->client_fd < 0 && c->client_to_server_buffer_full <= 0)
goto quit;
r = connection_enable_event_sources(c);