From b7f3618f3933a810778093fd47564a1e3bf3fde6 Mon Sep 17 00:00:00 2001 From: Rich Coe Date: Wed, 5 Dec 2007 19:36:37 +0000 Subject: OS: Connection: Keep trying select while it gets interrupted (bug #9240) If we got interrupted (EINTR or EAGAIN) during select, just try again, rather than shutting clients down on either of these errors. --- os/connection.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'os/connection.c') diff --git a/os/connection.c b/os/connection.c index 6012a8e81..be7521f3d 100644 --- a/os/connection.c +++ b/os/connection.c @@ -1057,7 +1057,9 @@ CheckConnections(void) curclient = curoff + (i * (sizeof(fd_mask)*8)); FD_ZERO(&tmask); FD_SET(curclient, &tmask); - r = Select (curclient + 1, &tmask, NULL, NULL, ¬ime); + do { + r = Select (curclient + 1, &tmask, NULL, NULL, ¬ime); + } while (r < 0 && (errno == EINTR || errno == EAGAIN)); if (r < 0) if (ConnectionTranslation[curclient] > 0) CloseDownClient(clients[ConnectionTranslation[curclient]]); @@ -1071,9 +1073,12 @@ CheckConnections(void) curclient = XFD_FD(&savedAllClients, i); FD_ZERO(&tmask); FD_SET(curclient, &tmask); - r = Select (curclient + 1, &tmask, NULL, NULL, ¬ime); - if (r < 0 && GetConnectionTranslation(curclient) > 0) - CloseDownClient(clients[GetConnectionTranslation(curclient)]); + do { + r = Select (curclient + 1, &tmask, NULL, NULL, ¬ime); + } while (r < 0 && (errno == EINTR || errno == EAGAIN)); + if (r < 0) + if (GetConnectionTranslation(curclient) > 0) + CloseDownClient(clients[GetConnectionTranslation(curclient)]); } #endif } -- cgit v1.2.3