Changeset e8d03d1408b0cf0b7490a4889551a0531af5e2af

Show
Ignore:
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
  • src/network/httpd.c

    r29cd2f9 re8d03d1  
    20162016    counter_t *p_total_counter = stats_CounterCreate( host, VLC_VAR_INTEGER, STATS_COUNTER ); 
    20172017    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 ) 
    20202021    { 
    20212022        if( host->i_url <= 0 ) 
    20222023        { 
    2023             /* 0.2s */ 
     2024            /* 0.2s (FIXME: use a condition variable) */ 
    20242025            msleep( 200000 ); 
    20252026            continue; 
     
    20302031            p_tls = tls_ServerSessionPrepare( host->p_tls ); 
    20312032 
    2032         struct pollfd ufd[host->nfd + host->i_client]; 
     2033        struct pollfd ufd[host->nfd + host->i_client + 1]; 
    20332034        unsigned nfd; 
    20342035        for( nfd = 0; nfd < host->nfd; nfd++ ) 
     
    24002401                    cl->i_state = HTTPD_CLIENT_SENDING; 
    24012402                } 
    2402                 else 
    2403                 { 
    2404                     /* we shouldn't wait too long */ 
    2405                     b_low_delay = VLC_TRUE; 
    2406                 } 
    24072403            } 
    24082404 
     
    24162412            if (pufd->events != 0) 
    24172413                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 ); 
    24192427        vlc_mutex_unlock( &host->lock ); 
    24202428 
    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) ) 
    24232431        { 
    24242432            case -1: 
    24252433                if (errno != EINTR) 
    24262434                { 
    2427                     /* This is most likely a bug */ 
     2435                    /* Kernel on low memory or a bug: pace */ 
    24282436                    msg_Err( host, "polling error: %m" ); 
    2429                     msleep( 1000 ); 
     2437                    msleep( 100000 ); 
    24302438                } 
    24312439            case 0: 
    24322440                continue; 
    24332441        } 
     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 ); 
    24342447 
    24352448        /* Handle client sockets */