Commit c702562a authored by Stefan Fritsch's avatar Stefan Fritsch
Browse files

Formatting changes, reuse 'now' variable instead of declaring a new one

in several blocks.

No significant code change.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1137260 13f79535-47bb-0310-9956-ffa450edef68
parent 86ba6d9d
Loading
Loading
Loading
Loading
+42 −54
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@ static int start_thread_may_exit = 0;
static int listener_may_exit = 0;
static int requests_this_child;
static int num_listensocks = 0;
static apr_uint32_t connection_count = 0;
static int resource_shortage = 0;
static fd_queue_t *worker_queue;
static fd_queue_info_t *worker_queue_info;
@@ -504,7 +505,6 @@ static int child_fatal;
static int volatile shutdown_pending;
static int volatile restart_pending;
ap_generation_t volatile ap_my_generation = 0;
static apr_uint32_t connection_count = 0;

static apr_status_t decrement_connection_count(void *dummy) {
    apr_atomic_dec32(&connection_count);
@@ -1111,9 +1111,8 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy)
    conn_state_t *cs;
    const apr_pollfd_t *out_pfd;
    apr_int32_t num = 0;
    apr_time_t time_now = 0;
    apr_interval_time_t timeout_interval;
    apr_time_t timeout_time;
    apr_time_t timeout_time, now;
    listener_poll_type *pt;
    int closed = 0;

@@ -1155,10 +1154,8 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy)
        }


        {
            apr_time_t now = apr_time_now();
        now = apr_time_now();
        apr_thread_mutex_lock(g_timer_ring_mtx);

        if (!APR_RING_EMPTY(&timer_ring, timer_event_t, link)) {
            te = APR_RING_FIRST(&timer_ring);
            if (te->when > now) {
@@ -1172,17 +1169,14 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy)
            timeout_interval = apr_time_from_msec(100);
        }
        apr_thread_mutex_unlock(g_timer_ring_mtx);
        }

#if HAVE_SERF
        rc = serf_context_prerun(g_serf);
        if (rc != APR_SUCCESS) {
            /* TOOD: what should do here? ugh. */
        }
        
#endif
        rc = apr_pollset_poll(event_pollset, timeout_interval, &num,
                              &out_pfd);
        rc = apr_pollset_poll(event_pollset, timeout_interval, &num, &out_pfd);

        if (rc != APR_SUCCESS) {
            if (APR_STATUS_IS_EINTR(rc)) {
@@ -1198,14 +1192,12 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy)

        if (listener_may_exit) {
            close_listeners(process_slot, &closed);
            if (terminate_mode == ST_UNGRACEFUL ||
                apr_atomic_read32(&connection_count) == 0) {
            if (terminate_mode == ST_UNGRACEFUL
                || apr_atomic_read32(&connection_count) == 0)
                break;
        }
        }

        {
            apr_time_t now = apr_time_now();
        now = apr_time_now();
        apr_thread_mutex_lock(g_timer_ring_mtx);
        for (ep = APR_RING_FIRST(&timer_ring);
             ep != APR_RING_SENTINEL(&timer_ring,
@@ -1221,7 +1213,6 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy)
            }
        }
        apr_thread_mutex_unlock(g_timer_ring_mtx);
        }

        while (num && get_worker(&have_idle_worker)) {
            pt = (listener_poll_type *) out_pfd->client_data;
@@ -1331,14 +1322,14 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy)
        /* XXX possible optimization: stash the current time for use as
         * r->request_time for new requests
         */
        time_now = apr_time_now();
        now = apr_time_now();

        /* handle timed out sockets */
        apr_thread_mutex_lock(timeout_mutex);

        /* Step 1: keepalive timeouts */
        cs = APR_RING_FIRST(&keepalive_timeout_head);
        timeout_time = time_now + TIMEOUT_FUDGE_FACTOR;
        timeout_time = now + TIMEOUT_FUDGE_FACTOR;
        while (!APR_RING_EMPTY(&keepalive_timeout_head, conn_state_t, timeout_list)
               && cs->expiration_time < timeout_time) {

@@ -1453,7 +1444,6 @@ static void *APR_THREAD_FUNC worker_thread(apr_thread_t * thd, void *dummy)
        }

        te = NULL;
        
        rv = ap_queue_pop_something(worker_queue, &csd, &cs, &ptrans, &te);

        if (rv != APR_SUCCESS) {
@@ -1485,7 +1475,6 @@ static void *APR_THREAD_FUNC worker_thread(apr_thread_t * thd, void *dummy)
            continue;
        }
        if (te != NULL) {
            
            te->cbfunc(te->baton);

            {
@@ -1506,7 +1495,7 @@ static void *APR_THREAD_FUNC worker_thread(apr_thread_t * thd, void *dummy)
    }

    ap_update_child_status_from_indexes(process_slot, thread_slot,
                                        (dying) ? SERVER_DEAD :
                                        dying ? SERVER_DEAD :
                                        SERVER_GRACEFUL,
                                        (request_rec *) NULL);

@@ -1775,7 +1764,6 @@ static void child_main(int child_num_arg)
    apr_thread_mutex_create(&g_timer_ring_mtx, APR_THREAD_MUTEX_DEFAULT, pchild);
    APR_RING_INIT(&timer_free_ring, timer_event_t, link);
    APR_RING_INIT(&timer_ring, timer_event_t, link);
    
    ap_run_child_init(pchild, ap_server_conf);

    /* done with init critical section */