Commit d2cbad5e authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

backend_probe: Use a VTIM duration

parent 75ea7f62
...@@ -273,8 +273,9 @@ vbp_write_proxy_v1(struct vbp_target *vt, int *sock) ...@@ -273,8 +273,9 @@ vbp_write_proxy_v1(struct vbp_target *vt, int *sock)
static void static void
vbp_poke(struct vbp_target *vt) vbp_poke(struct vbp_target *vt)
{ {
int s, tmo, i, proxy_header, err; int s, i, proxy_header, err;
vtim_real t_start, t_now, t_end; vtim_real t_start, t_now, t_end;
vtim_dur tmo;
unsigned rlen, resp; unsigned rlen, resp;
char buf[8192], *p; char buf[8192], *p;
struct pollfd pfda[1], *pfd = pfda; struct pollfd pfda[1], *pfd = pfda;
...@@ -304,11 +305,11 @@ vbp_poke(struct vbp_target *vt) ...@@ -304,11 +305,11 @@ vbp_poke(struct vbp_target *vt)
WRONG("Wrong probe protocol family"); WRONG("Wrong probe protocol family");
t_now = VTIM_real(); t_now = VTIM_real();
tmo = (int)round((t_end - t_now) * 1e3); tmo = t_end - t_now;
if (tmo <= 0) { if (tmo <= 0) {
bprintf(vt->resp_buf, bprintf(vt->resp_buf,
"Open timeout %.3fs exceeded by %.3fs", "Open timeout %.3fs exceeded by %.3fs",
vt->timeout, t_now - t_end); vt->timeout, -tmo);
VTCP_close(&s); VTCP_close(&s);
return; return;
} }
...@@ -347,15 +348,15 @@ vbp_poke(struct vbp_target *vt) ...@@ -347,15 +348,15 @@ vbp_poke(struct vbp_target *vt)
pfd->events = POLLIN; pfd->events = POLLIN;
pfd->revents = 0; pfd->revents = 0;
t_now = VTIM_real(); t_now = VTIM_real();
tmo = (int)round((t_end - t_now) * 1e3); tmo = t_end - t_now;
if (tmo <= 0) { if (tmo <= 0) {
bprintf(vt->resp_buf, bprintf(vt->resp_buf,
"Poll timeout %.3fs exceeded by %.3fs", "Poll timeout %.3fs exceeded by %.3fs",
vt->timeout, t_now - t_end); vt->timeout, -tmo);
i = -1; i = -1;
break; break;
} }
i = poll(pfd, 1, tmo); i = poll(pfd, 1, VTIM_poll_tmo(tmo));
if (i <= 0) { if (i <= 0) {
if (!i) { if (!i) {
if (!vt->exp_close) if (!vt->exp_close)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment