From 4aa73e29f88216f9d06eddfc3a5142a69984ca58 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 14 Dec 2015 14:28:29 +1100 Subject: [PATCH] Use the cs->fd handle directy in case it gets invalidated while we're waiting for a socket line --- src/ckpool.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ckpool.c b/src/ckpool.c index e74aa0ca..1f591a1f 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -500,13 +500,13 @@ void empty_buffer(connsock_t *cs) * of the buffer for use on the next receive. */ int read_socket_line(connsock_t *cs, float *timeout) { - int fd = cs->fd, ret = -1; char *eom = NULL; tv_t start, now; size_t buflen; + int ret = -1; float diff; - if (unlikely(fd < 0)) + if (unlikely(cs->fd < 0)) goto out; if (unlikely(!cs->buf)) @@ -527,7 +527,7 @@ rewait: ret = 0; goto out; } - ret = wait_read_select(fd, eom ? 0 : *timeout); + ret = wait_read_select(cs->fd, eom ? 0 : *timeout); if (ret < 1) { if (!ret) { if (eom) @@ -546,7 +546,7 @@ rewait: int backoff = 1; char *newbuf; - ret = recv(fd, readbuf, PAGESIZE - 4, MSG_DONTWAIT); + ret = recv(cs->fd, readbuf, PAGESIZE - 4, MSG_DONTWAIT); if (ret < 1) { /* No more to read or closed socket after valid message */ if (eom)