Overview
Comment: | Log the connect time, which is significant for closed sockets since they have no request time (since no request was made) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | remove-c11-atomics |
Files: | files | file ages | folders |
SHA1: |
05f8958cc763877ab5777d50dc1ad59d |
User & Date: | rkeene on 2020-03-31 14:20:10 |
Other Links: | branch diff | manifest | tags |
Context
2020-03-31
| ||
14:26 | Made socket idle timeout checks more frequent Closed-Leaf check-in: fe6d401e68 user: rkeene tags: remove-c11-atomics | |
14:20 | Log the connect time, which is significant for closed sockets since they have no request time (since no request was made) check-in: 05f8958cc7 user: rkeene tags: remove-c11-atomics | |
14:19 | Use a mutex (for now?) for closing idle sockets check-in: 158143b222 user: rkeene tags: remove-c11-atomics | |
Changes
Modified filed.c from [a328ae775d] to [20cb1acc5e].
︙ | ︙ | |||
178 179 180 181 182 183 184 185 186 187 188 189 190 191 | /* Message buffer for type = MESSAGE */ /* Path buffer for type = TRANSFER */ char buffer[FILED_PATH_BUFFER_SIZE]; /* Items for type = TRANSFER */ int http_code; const char *reason; time_t starttime; time_t endtime; off_t req_offset; off_t req_length; off_t sent_length; off_t file_length; char ip[128]; | > | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | /* Message buffer for type = MESSAGE */ /* Path buffer for type = TRANSFER */ char buffer[FILED_PATH_BUFFER_SIZE]; /* Items for type = TRANSFER */ int http_code; const char *reason; time_t connecttime; time_t starttime; time_t endtime; off_t req_offset; off_t req_length; off_t sent_length; off_t file_length; char ip[128]; |
︙ | ︙ | |||
460 461 462 463 464 465 466 | break; } if (curr->endtime == ((time_t) -1)) { curr->endtime = now; } | | > | 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | break; } if (curr->endtime == ((time_t) -1)) { curr->endtime = now; } fprintf(fp, "TRANSFER METHOD=%s PATH=%s SRC=%s:%i CLIENT.TIME.CONNECT=%llu REQUEST.TIME.START=%llu REQUEST.TIME.END=%llu CODE.VALUE=%u CODE.REASON=%s REQUEST.OFFSET=%llu REQUEST.LENGTH=%llu FILE.LENGTH=%llu TRANSFER.LENGTH=%llu", method, curr->buffer, curr->ip, curr->port, (unsigned long long) curr->connecttime, (unsigned long long) curr->starttime, (unsigned long long) curr->endtime, curr->http_code, curr->reason, (unsigned long long) curr->req_offset, (unsigned long long) curr->req_length, (unsigned long long) curr->file_length, (unsigned long long) curr->sent_length |
︙ | ︙ | |||
514 515 516 517 518 519 520 521 522 523 524 525 526 527 | struct filed_log_entry *retval; retval = malloc(sizeof(*retval)); if (initialize) { retval->buffer[0] = '\0'; retval->http_code = -1; retval->starttime = 0; retval->endtime = 0; retval->req_offset = 0; retval->req_length = 0; retval->sent_length = 0; retval->file_length = 0; retval->ip[0] = '\0'; | > | 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | struct filed_log_entry *retval; retval = malloc(sizeof(*retval)); if (initialize) { retval->buffer[0] = '\0'; retval->http_code = -1; retval->connecttime = 0; retval->starttime = 0; retval->endtime = 0; retval->req_offset = 0; retval->req_length = 0; retval->sent_length = 0; retval->file_length = 0; retval->ip[0] = '\0'; |
︙ | ︙ | |||
1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 | ssize_t sendfile_ret; size_t sendfile_size; off_t sendfile_offset, sendfile_sent, sendfile_len; char *path; char *date_current, date_current_b[64]; int http_code; FILE *fp; /* Determine current time */ date_current = filed_format_time(date_current_b, sizeof(date_current_b), time(NULL)); /* Open socket as ANSI I/O for ease of use */ fp = fdopen(fd, "w+b"); if (fp == NULL) { | > > > | 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 | ssize_t sendfile_ret; size_t sendfile_size; off_t sendfile_offset, sendfile_sent, sendfile_len; char *path; char *date_current, date_current_b[64]; int http_code; FILE *fp; /* Indicate the connection start time */ log->connecttime = time(NULL); /* Determine current time */ date_current = filed_format_time(date_current_b, sizeof(date_current_b), time(NULL)); /* Open socket as ANSI I/O for ease of use */ fp = fdopen(fd, "w+b"); if (fp == NULL) { |
︙ | ︙ |