View | Details | Raw Unified | Return to bug 59333
Collapse All | Expand All

(-)include/httpd.h (+7 lines)
Lines 1083-1088 typedef enum { Link Here
1083
    AP_CONN_KEEPALIVE
1083
    AP_CONN_KEEPALIVE
1084
} ap_conn_keepalive_e;
1084
} ap_conn_keepalive_e;
1085
1085
1086
/* AP_SB_*_SIZE needed by conn_rec */
1087
#include "scoreboard.h"
1088
1086
/**
1089
/**
1087
 * @brief Structure to store things which are per connection
1090
 * @brief Structure to store things which are per connection
1088
 */
1091
 */
Lines 1183-1188 struct conn_rec { Link Here
1183
1186
1184
    /** The "real" master connection. NULL if I am the master. */
1187
    /** The "real" master connection. NULL if I am the master. */
1185
    conn_rec *master;
1188
    conn_rec *master;
1189
1190
    /** Preserve scoreboard's worker last request infos */
1191
    char sb_lastreq[AP_SB_REQ_SIZE];
1192
    char sb_lastvhost[AP_SB_VHOST_SIZE];
1186
};
1193
};
1187
1194
1188
/**
1195
/**
(-)include/scoreboard.h (-2 / +5 lines)
Lines 85-90 typedef enum { Link Here
85
    SB_SHARED = 2
85
    SB_SHARED = 2
86
} ap_scoreboard_e;
86
} ap_scoreboard_e;
87
87
88
#define AP_SB_REQ_SIZE   64
89
#define AP_SB_VHOST_SIZE 32
90
88
/* stuff which is worker specific */
91
/* stuff which is worker specific */
89
typedef struct worker_score worker_score;
92
typedef struct worker_score worker_score;
90
struct worker_score {
93
struct worker_score {
Lines 113-120 struct worker_score { Link Here
113
    struct tms times;
116
    struct tms times;
114
#endif
117
#endif
115
    char client[32];            /* Keep 'em small... */
118
    char client[32];            /* Keep 'em small... */
116
    char request[64];           /* We just want an idea... */
119
    char request[AP_SB_REQ_SIZE]; /* We just want an idea... */
117
    char vhost[32];             /* What virtual host is being accessed? */
120
    char vhost[AP_SB_VHOST_SIZE]; /* What virtual host is being accessed? */
118
    char protocol[16];          /* What protocol is used on the connection? */
121
    char protocol[16];          /* What protocol is used on the connection? */
119
};
122
};
120
123
(-)server/scoreboard.c (-47 / +54 lines)
Lines 464-485 static int update_child_status_internal(int child_ Link Here
464
{
464
{
465
    int old_status;
465
    int old_status;
466
    worker_score *ws;
466
    worker_score *ws;
467
    process_score *ps;
468
    int mpm_generation;
467
    int mpm_generation;
469
468
470
    ws = &ap_scoreboard_image->servers[child_num][thread_num];
469
    ws = &ap_scoreboard_image->servers[child_num][thread_num];
471
    old_status = ws->status;
470
    old_status = ws->status;
472
    if (status >= 0) {
471
    ws->status = status;
473
        ws->status = status;
472
    
474
        
473
    if (status == SERVER_READY
475
        ps = &ap_scoreboard_image->parent[child_num];
474
        && old_status == SERVER_STARTING) {
476
        
475
        process_score *ps = &ap_scoreboard_image->parent[child_num];
477
        if (status == SERVER_READY
476
        ws->thread_num = child_num * thread_limit + thread_num;
478
            && old_status == SERVER_STARTING) {
477
        ap_mpm_query(AP_MPMQ_GENERATION, &mpm_generation);
479
            ws->thread_num = child_num * thread_limit + thread_num;
478
        ps->generation = mpm_generation;
480
            ap_mpm_query(AP_MPMQ_GENERATION, &mpm_generation);
481
            ps->generation = mpm_generation;
482
        }
483
    }
479
    }
484
480
485
    if (ap_extended_status) {
481
    if (ap_extended_status) {
Lines 497-541 static int update_child_status_internal(int child_ Link Here
497
            ws->conn_bytes = 0;
493
            ws->conn_bytes = 0;
498
            ws->last_used = apr_time_now();
494
            ws->last_used = apr_time_now();
499
        }
495
        }
500
        if (status == SERVER_READY) {
496
501
            ws->client[0]='\0';
497
        if (descr) {
502
            ws->vhost[0]='\0';
498
            apr_cpystrn(ws->request, descr, sizeof(ws->request));
503
            ws->request[0]='\0';
504
            ws->protocol[0]='\0';
505
        }
499
        }
506
        else {
500
        else if (r) {
507
            if (descr) {
501
            copy_request(ws->request, sizeof(ws->request), r);
508
                apr_cpystrn(ws->request, descr, sizeof(ws->request));
502
        }
503
        else if (c && old_status == SERVER_READY) {
504
            apr_cpystrn(ws->request, c->sb_lastreq,
505
                        sizeof(ws->request));
506
        }
507
508
        if (r) {
509
            if (!(val = ap_get_useragent_host(r, REMOTE_NOLOOKUP, NULL)))
510
                apr_cpystrn(ws->client, r->useragent_ip, sizeof(ws->client));
511
            else
512
                apr_cpystrn(ws->client, val, sizeof(ws->client));
513
        }
514
        else if (c) {
515
            if (!(val = ap_get_remote_host(c, c->base_server->lookup_defaults,
516
                                           REMOTE_NOLOOKUP, NULL)))
517
                apr_cpystrn(ws->client, c->client_ip, sizeof(ws->client));
518
            else
519
                apr_cpystrn(ws->client, val, sizeof(ws->client));
520
        }
521
522
        if (s) {
523
            if (c) {
524
                apr_snprintf(ws->vhost, sizeof(ws->vhost), "%s:%d",
525
                             s->server_hostname, c->local_addr->port);
509
            }
526
            }
510
            else if (r) {
527
            else {
511
                copy_request(ws->request, sizeof(ws->request), r);
528
                apr_cpystrn(ws->vhost, s->server_hostname, sizeof(ws->vhost));
512
            }
529
            }
513
            if (r) {
530
        }
514
                if (!(val = ap_get_useragent_host(r, REMOTE_NOLOOKUP, NULL)))
531
        else if (c && old_status == SERVER_READY) {
515
                    apr_cpystrn(ws->client, r->useragent_ip, sizeof(ws->client));
532
            apr_cpystrn(ws->vhost, c->sb_lastvhost,
516
                else
533
                        sizeof(ws->vhost));
517
                    apr_cpystrn(ws->client, val, sizeof(ws->client));
534
        }
535
536
        if (c) {
537
            val = ap_get_protocol(c);
538
            apr_cpystrn(ws->protocol, val, sizeof(ws->protocol));
539
540
            if (status == SERVER_BUSY_LOG) {
541
                apr_cpystrn(c->sb_lastreq, ws->request,
542
                            sizeof(c->sb_lastreq));
543
                apr_cpystrn(c->sb_lastvhost, ws->vhost,
544
                            sizeof(c->sb_lastreq));
518
            }
545
            }
519
            else if (c) {
520
                if (!(val = ap_get_remote_host(c, c->base_server->lookup_defaults,
521
                                               REMOTE_NOLOOKUP, NULL)))
522
                    apr_cpystrn(ws->client, c->client_ip, sizeof(ws->client));
523
                else
524
                    apr_cpystrn(ws->client, val, sizeof(ws->client));
525
            }
526
            if (s) {
527
                if (c) {
528
                    apr_snprintf(ws->vhost, sizeof(ws->vhost), "%s:%d",
529
                                 s->server_hostname, c->local_addr->port);
530
                }
531
                else {
532
                    apr_cpystrn(ws->vhost, s->server_hostname, sizeof(ws->vhost));
533
                }
534
            }
535
            if (c) {
536
                val = ap_get_protocol(c);
537
                apr_cpystrn(ws->protocol, val, sizeof(ws->protocol));
538
            }
539
        }
546
        }
540
    }
547
    }
541
548

Return to bug 59333