[core] reuse r->start_hp.tv_sec for r->start_ts

(remove duplicated field from (request_st *))
personal/stbuehler/tests-path
Glenn Strauss 2020-09-23 10:43:16 -04:00
parent 660d719a2a
commit 1a64c9e2f7
5 changed files with 9 additions and 11 deletions

View File

@ -235,7 +235,7 @@ static void connection_handle_response_end_state(request_st * const r, connectio
r->bytes_read_ckpt = con->bytes_read;
r->bytes_written_ckpt = con->bytes_written;
#if 0
r->start_ts = con->read_idle_ts = log_epoch_secs;
r->start_hp.tv_sec = con->read_idle_ts = log_epoch_secs;
#endif
connection_set_state(r, CON_STATE_REQUEST_START);
} else {
@ -736,9 +736,9 @@ static int connection_handle_read_state(connection * const con) {
if (keepalive_request_start) {
if (con->bytes_read > r->bytes_read_ckpt) {
/* update r->start_ts timestamp when first byte of
/* update r->start_hp.tv_sec timestamp when first byte of
* next request is received on a keep-alive connection */
r->start_ts = log_epoch_secs;
r->start_hp.tv_sec = log_epoch_secs;
if (r->conf.high_precision_timestamps)
log_clock_gettime_realtime(&r->start_hp);
}
@ -1115,7 +1115,7 @@ connection_state_machine_loop (request_st * const r, connection * const con)
switch ((ostate = r->state)) {
case CON_STATE_REQUEST_START: /* transient */
/*(should not be reached by HTTP/2 streams)*/
r->start_ts = con->read_idle_ts = log_epoch_secs;
r->start_hp.tv_sec = con->read_idle_ts = log_epoch_secs;
if (r->conf.high_precision_timestamps)
log_clock_gettime_realtime(&r->start_hp);

View File

@ -1293,7 +1293,7 @@ h2_recv_headers (connection * const con, uint8_t * const s, uint32_t flen)
* timestamp when frame + CONTINUATION(s) are complete (so that
* re-read of initial frame does not overwrite the timestamp))
*/
r->start_ts = log_epoch_secs;
r->start_hp.tv_sec = log_epoch_secs;
if (r->conf.high_precision_timestamps)
log_clock_gettime_realtime(&r->start_hp);
}
@ -2613,7 +2613,6 @@ h2_con_upgrade_h2c (request_st * const h2r, const buffer * const http2_settings)
r->keep_alive = h2r->keep_alive;
r->tmp_buf = h2r->tmp_buf; /* shared; same as srv->tmp_buf */
r->start_hp = h2r->start_hp; /* copy struct */
r->start_ts = h2r->start_ts;
/* Note: HTTP/1.1 101 Switching Protocols is not immediately written to
* the network here. As this is called from cleartext Upgrade: h2c,

View File

@ -815,7 +815,7 @@ static int log_access_record (const request_st * const r, buffer * const b, form
if (f->opt & ~(FORMAT_FLAG_TIME_BEGIN|FORMAT_FLAG_TIME_END)) {
if (f->opt & FORMAT_FLAG_TIME_SEC) {
time_t t = (!(f->opt & FORMAT_FLAG_TIME_BEGIN)) ? log_epoch_secs : r->start_ts;
time_t t = (!(f->opt & FORMAT_FLAG_TIME_BEGIN)) ? log_epoch_secs : r->start_hp.tv_sec;
buffer_append_int(b, (intmax_t)t);
} else if (f->opt & (FORMAT_FLAG_TIME_MSEC|FORMAT_FLAG_TIME_USEC|FORMAT_FLAG_TIME_NSEC)) {
off_t t; /*(expected to be 64-bit since large file support enabled)*/
@ -887,7 +887,7 @@ static int log_access_record (const request_st * const r, buffer * const b, form
t = parsed_format->last_generated_accesslog_ts = cur_ts;
flush = 1;
} else {
t = r->start_ts;
t = r->start_hp.tv_sec;
}
#if defined(HAVE_STRUCT_TM_GMTOFF)
@ -936,7 +936,7 @@ static int log_access_record (const request_st * const r, buffer * const b, form
case FORMAT_TIME_USED:
case FORMAT_TIME_USED_US:
if (f->opt & FORMAT_FLAG_TIME_SEC) {
buffer_append_int(b, log_epoch_secs - r->start_ts);
buffer_append_int(b, log_epoch_secs - r->start_hp.tv_sec);
} else {
const struct timespec * const bs = &r->start_hp;
off_t tdiff; /*(expected to be 64-bit since large file support enabled)*/

View File

@ -244,7 +244,7 @@ static void mod_status_html_rtable_r (buffer * const b, const request_st * const
buffer_append_string_len(b, CONST_STR_LEN("</td><td class=\"int\">"));
buffer_append_int(b, cur_ts - r->start_ts);
buffer_append_int(b, cur_ts - r->start_hp.tv_sec);
buffer_append_string_len(b, CONST_STR_LEN("</td><td class=\"string\">"));

View File

@ -186,7 +186,6 @@ struct request_st {
off_t bytes_written_ckpt; /* used by mod_accesslog */
off_t bytes_read_ckpt; /* used by mod_accesslog */
struct timespec start_hp;
time_t start_ts;
int error_handler_saved_status; /* error-handler */
http_method_t error_handler_saved_method; /* error-handler */