Mercurial > hg > nginx
comparison src/event/modules/ngx_select_module.c @ 119:cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 20 Jul 2003 21:15:59 +0000 |
parents | ac69ab96328d |
children | b776ad95d96d |
comparison
equal
deleted
inserted
replaced
118:5bf52498665c | 119:cd54bcbaf3b5 |
---|---|
261 | 261 |
262 if (timer) { | 262 if (timer) { |
263 tv.tv_sec = timer / 1000; | 263 tv.tv_sec = timer / 1000; |
264 tv.tv_usec = (timer % 1000) * 1000; | 264 tv.tv_usec = (timer % 1000) * 1000; |
265 tp = &tv; | 265 tp = &tv; |
266 #if (HAVE_SELECT_CHANGE_TIMEOUT) | |
267 delta = 0; | |
268 #else | |
266 delta = ngx_msec(); | 269 delta = ngx_msec(); |
270 #endif | |
267 | 271 |
268 } else { | 272 } else { |
269 timer = 0; | 273 timer = 0; |
270 tp = NULL; | 274 tp = NULL; |
271 delta = 0; | 275 delta = 0; |
311 #if (NGX_DEBUG_EVENT) | 315 #if (NGX_DEBUG_EVENT) |
312 ngx_log_debug(log, "select ready %d" _ ready); | 316 ngx_log_debug(log, "select ready %d" _ ready); |
313 #endif | 317 #endif |
314 | 318 |
315 if (timer) { | 319 if (timer) { |
316 /* TODO: Linux returns time in tv */ | 320 #if (HAVE_SELECT_CHANGE_TIMEOUT) |
321 delta = timer - (tv.tv_sec * 1000 + tv.tv_usec / 1000); | |
322 #else | |
317 delta = ngx_msec() - delta; | 323 delta = ngx_msec() - delta; |
324 #endif | |
318 | 325 |
319 #if (NGX_DEBUG_EVENT) | 326 #if (NGX_DEBUG_EVENT) |
320 ngx_log_debug(log, "select timer: %d, delta: %d" _ timer _ delta); | 327 ngx_log_debug(log, "select timer: %d, delta: %d" _ timer _ delta); |
321 #endif | 328 #endif |
322 ngx_event_expire_timers(delta); | 329 ngx_event_expire_timers(delta); |
323 | 330 |
324 } else { | 331 } else { |
325 if (ready == 0) { | 332 if (ready == 0) { |
326 ngx_log_error(NGX_LOG_ALERT, log, 0, | 333 ngx_log_error(NGX_LOG_ALERT, log, 0, |
327 "select() returns no events without timeout"); | 334 "select() returned no events without timeout"); |
328 return NGX_ERROR; | 335 return NGX_ERROR; |
329 } | 336 } |
330 | 337 |
331 #if (NGX_DEBUG_EVENT) | 338 #if (NGX_DEBUG_EVENT) |
332 ngx_log_debug(log, "select timer: %d, delta: %d" _ timer _ delta); | 339 ngx_log_debug(log, "select timer: %d, delta: %d" _ timer _ delta); |
406 { | 413 { |
407 ngx_event_conf_t *ecf; | 414 ngx_event_conf_t *ecf; |
408 | 415 |
409 ecf = ngx_event_get_conf(cycle->conf_ctx, ngx_event_core_module); | 416 ecf = ngx_event_get_conf(cycle->conf_ctx, ngx_event_core_module); |
410 | 417 |
411 /* the default FD_SETSIZE is 1024U in FreeBSD 5.x */ | 418 /* disable warnings: the default FD_SETSIZE is 1024U in FreeBSD 5.x */ |
412 | 419 |
413 if ((unsigned) ecf->connections > FD_SETSIZE) { | 420 if ((unsigned) ecf->connections > FD_SETSIZE) { |
414 return "maximum number of connections " | 421 return "maximum number of connections " |
415 "supported by select() is " ngx_value(FD_SETSIZE); | 422 "supported by select() is " ngx_value(FD_SETSIZE); |
416 } | 423 } |