This is an automated email from the git hooks/post-receive script.
rharwood pushed a commit to branch master in repository gssproxy.
commit d55be9fa2455fe52b6eb904ad427f22141ab3f26 Author: Simo Sorce simo@redhat.com AuthorDate: Wed Mar 6 10:36:11 2019 -0500
Add a safety timeout to epoll
Add a safety timeout just in case something goes wrong with the use of timerfd. This way the process should't be stuck forever.
Signed-off-by: Simo Sorce simo@redhat.com [rharwood@redhat.com: remove outdated comment] Reviewed-by: Robbie Harwood rharwood@redhat.com Merges: #241 --- src/client/gpm_common.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/client/gpm_common.c b/src/client/gpm_common.c index d491200..95a39ab 100644 --- a/src/client/gpm_common.c +++ b/src/client/gpm_common.c @@ -14,6 +14,7 @@ #define FRAGMENT_BIT (1 << 31)
#define RESPONSE_TIMEOUT 15 +#define SAFETY_TIMEOUT RESPONSE_TIMEOUT * 10 * 1000 #define MAX_TIMEOUT_RETRY 3
struct gpm_ctx { @@ -291,7 +292,7 @@ static int gpm_epoll_wait(struct gpm_ctx *gpmctx, uint32_t event_flags) }
do { - epoll_ret = epoll_wait(gpmctx->epollfd, events, 2, -1); + epoll_ret = epoll_wait(gpmctx->epollfd, events, 2, SAFETY_TIMEOUT); } while (epoll_ret < 0 && errno == EINTR);
if (epoll_ret < 0) { @@ -299,8 +300,6 @@ static int gpm_epoll_wait(struct gpm_ctx *gpmctx, uint32_t event_flags) ret = errno; gpm_epoll_close(gpmctx); } else if (epoll_ret == 0) { - /* Shouldn't happen as timeout == -1; treat it like a timeout - * occurred. */ ret = ETIMEDOUT; gpm_epoll_close(gpmctx); } else if (epoll_ret == 1 && events[0].data.fd == gpmctx->timerfd) {