]> git.ipfire.org Git - thirdparty/haproxy.git/commit
[OPTIM] checks: try to detect the end of response without polling again
authorWilly Tarreau <w@1wt.eu>
Tue, 16 Mar 2010 19:32:04 +0000 (20:32 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 16 Mar 2010 21:57:27 +0000 (22:57 +0100)
commit2c7ace07ad1ced87daefb82744b3d417dd606e85
treedb34ad31a409e3021da7feb574b4108478fc26b1
parent57b1bf778590b9a87409a676a110400fdb58b383
[OPTIM] checks: try to detect the end of response without polling again

Since the recv() call returns every time it succeeds, we always need
to calls with one intermediate poll before detecting the end of response :

  20:20:03.958207 recv(7, "HTTP/1.1 200\r\nConnection: close\r\n"..., 8030, 0) = 145
  20:20:03.958365 epoll_wait(3, {{EPOLLIN, {u32=7, u64=7}}}, 8, 1000) = 1
  20:20:03.958543 gettimeofday({1268767203, 958626}, NULL) = 0
  20:20:03.958694 recv(7, ""..., 7885, 0) = 0
  20:20:03.958833 shutdown(7, 2 /* send and receive */) = 0

Let's read as long as we can, that way we can detect end of connections
in the same call, which is much more efficient especially for LBs with
hundreds of servers :

  20:29:58.797019 recv(7, "HTTP/1.1 200\r\nConnection: close\r\n"..., 8030, 0) = 145
  20:29:58.797182 recv(7, ""..., 7885, 0) = 0
  20:29:58.797356 shutdown(7, 2 /* send and receive */) = 0
src/checks.c