Commit f1d99bbdcd395651e9c1ee71825e29b503f4129a
Committed by
Anthony Liguori
1 parent
d6cf84e1
slirp: Clean up timeout handling around slirp_select_fill/poll
Again lot of dead code. Remove it. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing
3 changed files
with
4 additions
and
39 deletions
slirp/misc.c
| @@ -14,8 +14,6 @@ | @@ -14,8 +14,6 @@ | ||
| 14 | int slirp_debug = DBG_CALL|DBG_MISC|DBG_ERROR; | 14 | int slirp_debug = DBG_CALL|DBG_MISC|DBG_ERROR; |
| 15 | #endif | 15 | #endif |
| 16 | 16 | ||
| 17 | -u_int curtime, time_fasttimo, last_slowtimo; | ||
| 18 | - | ||
| 19 | struct quehead { | 17 | struct quehead { |
| 20 | struct quehead *qh_link; | 18 | struct quehead *qh_link; |
| 21 | struct quehead *qh_rlink; | 19 | struct quehead *qh_rlink; |
slirp/misc.h
| @@ -17,7 +17,6 @@ struct ex_list { | @@ -17,7 +17,6 @@ struct ex_list { | ||
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | extern struct ex_list *exec_list; | 19 | extern struct ex_list *exec_list; |
| 20 | -extern u_int time_fasttimo, last_slowtimo; | ||
| 21 | 20 | ||
| 22 | #ifndef HAVE_STRDUP | 21 | #ifndef HAVE_STRDUP |
| 23 | char *strdup _P((const char *)); | 22 | char *strdup _P((const char *)); |
slirp/slirp.c
| @@ -52,13 +52,16 @@ static struct in_addr client_ipaddr; | @@ -52,13 +52,16 @@ static struct in_addr client_ipaddr; | ||
| 52 | static const uint8_t zero_ethaddr[6] = { 0, 0, 0, 0, 0, 0 }; | 52 | static const uint8_t zero_ethaddr[6] = { 0, 0, 0, 0, 0, 0 }; |
| 53 | 53 | ||
| 54 | int slirp_restrict; | 54 | int slirp_restrict; |
| 55 | -static int do_slowtimo; | ||
| 56 | int link_up; | 55 | int link_up; |
| 57 | struct ex_list *exec_list; | 56 | struct ex_list *exec_list; |
| 58 | 57 | ||
| 59 | /* XXX: suppress those select globals */ | 58 | /* XXX: suppress those select globals */ |
| 60 | fd_set *global_readfds, *global_writefds, *global_xfds; | 59 | fd_set *global_readfds, *global_writefds, *global_xfds; |
| 61 | 60 | ||
| 61 | +u_int curtime; | ||
| 62 | +static u_int time_fasttimo, last_slowtimo; | ||
| 63 | +static int do_slowtimo; | ||
| 64 | + | ||
| 62 | char slirp_hostname[33]; | 65 | char slirp_hostname[33]; |
| 63 | 66 | ||
| 64 | #ifdef _WIN32 | 67 | #ifdef _WIN32 |
| @@ -267,9 +270,7 @@ void slirp_select_fill(int *pnfds, | @@ -267,9 +270,7 @@ void slirp_select_fill(int *pnfds, | ||
| 267 | fd_set *readfds, fd_set *writefds, fd_set *xfds) | 270 | fd_set *readfds, fd_set *writefds, fd_set *xfds) |
| 268 | { | 271 | { |
| 269 | struct socket *so, *so_next; | 272 | struct socket *so, *so_next; |
| 270 | - struct timeval timeout; | ||
| 271 | int nfds; | 273 | int nfds; |
| 272 | - int tmp_time; | ||
| 273 | 274 | ||
| 274 | if (!link_up) { | 275 | if (!link_up) { |
| 275 | return; | 276 | return; |
| @@ -380,39 +381,6 @@ void slirp_select_fill(int *pnfds, | @@ -380,39 +381,6 @@ void slirp_select_fill(int *pnfds, | ||
| 380 | } | 381 | } |
| 381 | } | 382 | } |
| 382 | 383 | ||
| 383 | - /* | ||
| 384 | - * Setup timeout to use minimum CPU usage, especially when idle | ||
| 385 | - */ | ||
| 386 | - | ||
| 387 | - /* | ||
| 388 | - * First, see the timeout needed by *timo | ||
| 389 | - */ | ||
| 390 | - timeout.tv_sec = 0; | ||
| 391 | - timeout.tv_usec = -1; | ||
| 392 | - /* | ||
| 393 | - * If a slowtimo is needed, set timeout to 500ms from the last | ||
| 394 | - * slow timeout. If a fast timeout is needed, set timeout within | ||
| 395 | - * 200ms of when it was requested. | ||
| 396 | - */ | ||
| 397 | - if (do_slowtimo) { | ||
| 398 | - /* XXX + 10000 because some select()'s aren't that accurate */ | ||
| 399 | - timeout.tv_usec = ((500 - (curtime - last_slowtimo)) * 1000) + 10000; | ||
| 400 | - if (timeout.tv_usec < 0) | ||
| 401 | - timeout.tv_usec = 0; | ||
| 402 | - else if (timeout.tv_usec > 510000) | ||
| 403 | - timeout.tv_usec = 510000; | ||
| 404 | - | ||
| 405 | - /* Can only fasttimo if we also slowtimo */ | ||
| 406 | - if (time_fasttimo) { | ||
| 407 | - tmp_time = (200 - (curtime - time_fasttimo)) * 1000; | ||
| 408 | - if (tmp_time < 0) | ||
| 409 | - tmp_time = 0; | ||
| 410 | - | ||
| 411 | - /* Choose the smallest of the 2 */ | ||
| 412 | - if (tmp_time < timeout.tv_usec) | ||
| 413 | - timeout.tv_usec = (u_int)tmp_time; | ||
| 414 | - } | ||
| 415 | - } | ||
| 416 | *pnfds = nfds; | 384 | *pnfds = nfds; |
| 417 | } | 385 | } |
| 418 | 386 |