Changeset e8d03d1408b0cf0b7490a4889551a0531af5e2af
- Timestamp:
- 01/10/07 20:04:10
(1 year ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1191261850 +0000
- git-parent:
[4f8856eeb7e633ee66a0e56a191ba43cc20a705d]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1191261850 +0000
- Message:
Removed b_die arbitrary timer from httpd.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r29cd2f9 |
re8d03d1 |
|
| 2016 | 2016 | counter_t *p_total_counter = stats_CounterCreate( host, VLC_VAR_INTEGER, STATS_COUNTER ); |
|---|
| 2017 | 2017 | counter_t *p_active_counter = stats_CounterCreate( host, VLC_VAR_INTEGER, STATS_COUNTER ); |
|---|
| 2018 | | |
|---|
| 2019 | | while( !host->b_die ) |
|---|
| | 2018 | vlc_bool_t b_die = VLC_FALSE; |
|---|
| | 2019 | |
|---|
| | 2020 | while( !b_die ) |
|---|
| 2020 | 2021 | { |
|---|
| 2021 | 2022 | if( host->i_url <= 0 ) |
|---|
| 2022 | 2023 | { |
|---|
| 2023 | | /* 0.2s */ |
|---|
| | 2024 | /* 0.2s (FIXME: use a condition variable) */ |
|---|
| 2024 | 2025 | msleep( 200000 ); |
|---|
| 2025 | 2026 | continue; |
|---|
| … | … | |
| 2030 | 2031 | p_tls = tls_ServerSessionPrepare( host->p_tls ); |
|---|
| 2031 | 2032 | |
|---|
| 2032 | | struct pollfd ufd[host->nfd + host->i_client]; |
|---|
| | 2033 | struct pollfd ufd[host->nfd + host->i_client + 1]; |
|---|
| 2033 | 2034 | unsigned nfd; |
|---|
| 2034 | 2035 | for( nfd = 0; nfd < host->nfd; nfd++ ) |
|---|
| … | … | |
| 2400 | 2401 | cl->i_state = HTTPD_CLIENT_SENDING; |
|---|
| 2401 | 2402 | } |
|---|
| 2402 | | else |
|---|
| 2403 | | { |
|---|
| 2404 | | /* we shouldn't wait too long */ |
|---|
| 2405 | | b_low_delay = VLC_TRUE; |
|---|
| 2406 | | } |
|---|
| 2407 | 2403 | } |
|---|
| 2408 | 2404 | |
|---|
| … | … | |
| 2416 | 2412 | if (pufd->events != 0) |
|---|
| 2417 | 2413 | nfd++; |
|---|
| 2418 | | } |
|---|
| | 2414 | else |
|---|
| | 2415 | b_low_delay = VLC_TRUE; |
|---|
| | 2416 | } |
|---|
| | 2417 | |
|---|
| | 2418 | vlc_object_lock( host ); |
|---|
| | 2419 | int evfd = ufd[nfd].fd = vlc_object_waitpipe( host ); |
|---|
| | 2420 | if( ufd[nfd].fd != -1 ) |
|---|
| | 2421 | { |
|---|
| | 2422 | ufd[nfd].events = POLLIN; |
|---|
| | 2423 | ufd[nfd].revents = 0; |
|---|
| | 2424 | nfd++; |
|---|
| | 2425 | } |
|---|
| | 2426 | vlc_object_unlock( host ); |
|---|
| 2419 | 2427 | vlc_mutex_unlock( &host->lock ); |
|---|
| 2420 | 2428 | |
|---|
| 2421 | | /* we will wait 100ms or 20ms (not too big 'cause HTTPD_CLIENT_WAITING) */ |
|---|
| 2422 | | switch( poll( ufd, nfd, b_low_delay ? 20 : 100) ) |
|---|
| | 2429 | /* we will wait 20ms (not too big) if HTTPD_CLIENT_WAITING */ |
|---|
| | 2430 | switch( poll( ufd, nfd, b_low_delay ? 20 : -1) ) |
|---|
| 2423 | 2431 | { |
|---|
| 2424 | 2432 | case -1: |
|---|
| 2425 | 2433 | if (errno != EINTR) |
|---|
| 2426 | 2434 | { |
|---|
| 2427 | | /* This is most likely a bug */ |
|---|
| | 2435 | /* Kernel on low memory or a bug: pace */ |
|---|
| 2428 | 2436 | msg_Err( host, "polling error: %m" ); |
|---|
| 2429 | | msleep( 1000 ); |
|---|
| | 2437 | msleep( 100000 ); |
|---|
| 2430 | 2438 | } |
|---|
| 2431 | 2439 | case 0: |
|---|
| 2432 | 2440 | continue; |
|---|
| 2433 | 2441 | } |
|---|
| | 2442 | |
|---|
| | 2443 | vlc_object_lock( host ); |
|---|
| | 2444 | if( ( evfd != -1 ) && ( ufd[nfd - 1].revents ) ) |
|---|
| | 2445 | b_die = vlc_object_wait( host ); |
|---|
| | 2446 | vlc_object_unlock( host ); |
|---|
| 2434 | 2447 | |
|---|
| 2435 | 2448 | /* Handle client sockets */ |
|---|