|
Lines 196-203
wait_until_can_do_something(int connecti
Link Here
|
| 196 |
{ |
196 |
{ |
| 197 |
struct timeval tv, *tvp; |
197 |
struct timeval tv, *tvp; |
| 198 |
int ret; |
198 |
int ret; |
| 199 |
time_t minwait_secs = 0; |
199 |
time_t minwait_secs = 0, now; |
| 200 |
int client_alive_scheduled = 0; |
200 |
int client_alive_scheduled = 0; |
|
|
201 |
static time_t last_client_time; |
| 201 |
|
202 |
|
| 202 |
/* Allocate and update select() masks for channel descriptors. */ |
203 |
/* Allocate and update select() masks for channel descriptors. */ |
| 203 |
channel_prepare_select(readsetp, writesetp, maxfdp, nallocp, |
204 |
channel_prepare_select(readsetp, writesetp, maxfdp, nallocp, |
|
Lines 262-269
wait_until_can_do_something(int connecti
Link Here
|
| 262 |
memset(*writesetp, 0, *nallocp); |
263 |
memset(*writesetp, 0, *nallocp); |
| 263 |
if (errno != EINTR) |
264 |
if (errno != EINTR) |
| 264 |
error("select: %.100s", strerror(errno)); |
265 |
error("select: %.100s", strerror(errno)); |
| 265 |
} else if (ret == 0 && client_alive_scheduled) |
266 |
} else if (client_alive_scheduled) { |
| 266 |
client_alive_check(); |
267 |
if (ret == 0) { /* timeout */ |
|
|
268 |
client_alive_check(); |
| 269 |
} else if (FD_ISSET(connection_in, *readsetp)) { |
| 270 |
last_client_time = monotime(); |
| 271 |
} else if (last_client_time != 0 && last_client_time + |
| 272 |
options.client_alive_interval < (now = monotime())) { |
| 273 |
client_alive_check(); |
| 274 |
last_client_time = now; |
| 275 |
} |
| 276 |
} |
| 267 |
|
277 |
|
| 268 |
notify_done(*readsetp); |
278 |
notify_done(*readsetp); |
| 269 |
} |
279 |
} |