Overview
Comment: | Updated to do less work if logging is disabled |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
7a401fd8d2c4023da3466a49360218fd |
User & Date: | rkeene on 2014-02-08 03:09:51 |
Other Links: | manifest | tags |
Context
2014-02-08
| ||
03:10 | Noted that status should be reported check-in: 1127550a5c user: rkeene tags: trunk | |
03:09 | Updated to do less work if logging is disabled check-in: 7a401fd8d2 user: rkeene tags: trunk | |
03:04 | Updated to compile correctly with logging disabled check-in: 66d99492b4 user: rkeene tags: trunk | |
Changes
Modified filed.c from [1884ac0577] to [1e9ce66531].
︙ | ︙ | |||
427 428 429 430 431 432 433 | size_t buffer_len, tmpbuffer_len; off_t range_start, range_end, range_length; int range_request; int fd; int i; fd = fileno(fp); | < | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | size_t buffer_len, tmpbuffer_len; off_t range_start, range_end, range_length; int range_request; int fd; int i; fd = fileno(fp); range_start = 0; range_end = 0; range_request = 0; range_length = -1; buffer = buffer_st->path_b; |
︙ | ︙ | |||
527 528 529 530 531 532 533 534 535 536 537 538 539 540 | /* Fill up structure to return */ buffer_st->path = path; buffer_st->headers.range.present = range_request; buffer_st->headers.range.offset = range_start; buffer_st->headers.range.length = range_length; return(buffer_st); } /* Return an error page */ static void filed_error_page(FILE *fp, const char *date_current, int error_number) { char *error_string = "<html><head><title>ERROR</title></head><body>Unable to process request</body></html>"; fprintf(fp, "HTTP/1.1 %i OK\r\nDate: %s\r\nServer: filed\r\nLast-Modified: %s\r\nContent-Length: %llu\r\nContent-Type: %s\r\nConnection: close\r\n\r\n%s", | > > > | 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | /* Fill up structure to return */ buffer_st->path = path; buffer_st->headers.range.present = range_request; buffer_st->headers.range.offset = range_start; buffer_st->headers.range.length = range_length; return(buffer_st); /* Make compiler happy */ fd = fd; } /* Return an error page */ static void filed_error_page(FILE *fp, const char *date_current, int error_number) { char *error_string = "<html><head><title>ERROR</title></head><body>Unable to process request</body></html>"; fprintf(fp, "HTTP/1.1 %i OK\r\nDate: %s\r\nServer: filed\r\nLast-Modified: %s\r\nContent-Length: %llu\r\nContent-Type: %s\r\nConnection: close\r\n\r\n%s", |
︙ | ︙ | |||
749 750 751 752 753 754 755 | } /* Handle incoming connections */ static void *filed_worker_thread(void *arg_v) { struct filed_worker_thread_args *arg; struct filed_http_request request; struct sockaddr_in6 addr; | | | 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 | } /* Handle incoming connections */ static void *filed_worker_thread(void *arg_v) { struct filed_worker_thread_args *arg; struct filed_http_request request; struct sockaddr_in6 addr; char logbuf_ip[128]; socklen_t addrlen; int failure_count = 0, max_failure_count = MAX_FAILURE_COUNT; int master_fd, fd; /* Read arguments */ arg = arg_v; |
︙ | ︙ | |||
783 784 785 786 787 788 789 | failure_count++; continue; } /* Log the new connection */ | | | | > > > > > > > | 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 | failure_count++; continue; } /* Log the new connection */ filed_log_msg("NEW_CONNECTION SRC_ADDR=%s SRC_PORT=%lu FD=%i", inet_ntop(AF_INET6, &addr.sin6_addr, logbuf_ip, sizeof(logbuf_ip)) ? logbuf_ip : "<unknown>", (unsigned long) addr.sin6_port, fd ); /* Reset failure count*/ failure_count = 0; /* Handle socket */ filed_handle_client(fd, &request); } /* Report error */ filed_log_msg("THREAD_DIED ABNORMAL"); return(NULL); /* Make compiler happy */ logbuf_ip[0] = '\0'; logbuf_ip[0] = logbuf_ip[0]; } /* Create worker threads */ static int filed_worker_threads_init(int fd, int thread_count) { struct filed_worker_thread_args *arg; pthread_t threadid; int pthread_ret; |
︙ | ︙ |