From: Ondřej Surý Date: Tue, 21 Jan 2020 07:25:30 +0000 (+0100) Subject: Clean the ENTER/EXIT/NOTICE debugging from production code X-Git-Tag: v9.14.11~12^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3828d4e3e9bd7871aa3fecf796ab8ca99146ad86;p=thirdparty%2Fbind9.git Clean the ENTER/EXIT/NOTICE debugging from production code (cherry picked from commit 5b448996e51609b2ed9c9a8c3a952f70e695694f) --- diff --git a/lib/isc/httpd.c b/lib/isc/httpd.c index 0f01f4e5e4c..2410f90a573 100644 --- a/lib/isc/httpd.c +++ b/lib/isc/httpd.c @@ -44,16 +44,6 @@ #define MSHUTTINGDOWN(cm) ((cm->flags & ISC_HTTPDMGR_FLAGSHUTTINGDOWN) != 0) #define MSETSHUTTINGDOWN(cm) (cm->flags |= ISC_HTTPDMGR_FLAGSHUTTINGDOWN) -#ifdef DEBUG_HTTPD -#define ENTER(x) do { fprintf(stderr, "ENTER %s\n", (x)); } while (0) -#define EXIT(x) do { fprintf(stderr, "EXIT %s\n", (x)); } while (0) -#define NOTICE(x) do { fprintf(stderr, "NOTICE %s\n", (x)); } while (0) -#else -#define ENTER(x) do { } while(0) -#define EXIT(x) do { } while(0) -#define NOTICE(x) do { } while(0) -#endif - #define HTTP_RECVLEN 1024 #define HTTP_SENDGROW 1024 #define HTTP_SEND_MAXLEN 10240 @@ -304,7 +294,7 @@ httpdmgr_socket_accept(isc_task_t *task, isc_httpdmgr_t* httpdmgr) return (result); } -static inline isc_result_t +static inline void httpd_socket_recv(isc_httpd_t *httpd, isc_region_t *region, isc_task_t *task) { isc_result_t result = ISC_R_SUCCESS; @@ -316,10 +306,9 @@ httpd_socket_recv(isc_httpd_t *httpd, isc_region_t *region, isc_task_t *task) if (result != ISC_R_SUCCESS) { INSIST(isc_refcount_decrement(&httpd->references) > 1); } - return (result); } -static inline isc_result_t +static inline void httpd_socket_send(isc_httpd_t *httpd, isc_region_t *region, isc_task_t *task) { isc_result_t result = ISC_R_SUCCESS; @@ -331,7 +320,6 @@ httpd_socket_send(isc_httpd_t *httpd, isc_region_t *region, isc_task_t *task) if (result != ISC_R_SUCCESS) { INSIST(isc_refcount_decrement(&httpd->references) > 1); } - return (result); } isc_result_t @@ -445,8 +433,6 @@ destroy_httpdmgr(isc_httpdmgr_t *httpdmgr) { INSIST(MSHUTTINGDOWN(httpdmgr)); INSIST(ISC_LIST_EMPTY(httpdmgr->running)); - NOTICE("httpdmgr_destroy detaching socket, task, and timermgr"); - isc_socket_detach(&httpdmgr->sock); isc_task_detach(&httpdmgr->task); httpdmgr->timermgr = NULL; @@ -548,8 +534,6 @@ process_request(isc_httpd_t *httpd, int length) { char *p; int delim; - ENTER("request"); - httpd->recvlen += length; httpd->recvbuf[httpd->recvlen] = 0; @@ -699,8 +683,6 @@ process_request(isc_httpd_t *httpd, int length) { && ((httpd->flags & HTTPD_FOUNDHOST) == 0)) return (ISC_R_RANGE); - EXIT("request"); - return (ISC_R_SUCCESS); } @@ -756,7 +738,6 @@ isc_httpd_create(isc_httpdmgr_t *httpdmgr, isc_socket_t *sock, static void isc_httpd_accept(isc_task_t *task, isc_event_t *ev) { - isc_result_t result; isc_httpdmgr_t *httpdmgr = ev->ev_arg; isc_httpd_t *httpd = NULL; isc_region_t r; @@ -765,22 +746,17 @@ isc_httpd_accept(isc_task_t *task, isc_event_t *ev) { REQUIRE(VALID_HTTPDMGR(httpdmgr)); - ENTER("accept"); - LOCK(&httpdmgr->lock); if (MSHUTTINGDOWN(httpdmgr)) { - NOTICE("accept shutting down, goto out"); goto out; } if (nev->result == ISC_R_CANCELED) { - NOTICE("accept canceled, goto out"); goto out; } if (nev->result != ISC_R_SUCCESS) { /* XXXMLG log failure */ - NOTICE("accept returned failure, goto requeue"); goto requeue; } @@ -800,16 +776,10 @@ isc_httpd_accept(isc_task_t *task, isc_event_t *ev) { r.base = (unsigned char *)httpd->recvbuf; r.length = HTTP_RECVLEN - 1; - result = httpd_socket_recv(httpd, &r, task); - if (result == ISC_R_SUCCESS) { - NOTICE("accept queued recv on socket"); - } + httpd_socket_recv(httpd, &r, task); requeue: - result = httpdmgr_socket_accept(task, httpdmgr); - if (result != ISC_R_SUCCESS) { - NOTICE("accept could not reaccept due to failure"); - } + (void)httpdmgr_socket_accept(task, httpdmgr); out: UNLOCK(&httpdmgr->lock); @@ -820,8 +790,6 @@ isc_httpd_accept(isc_task_t *task, isc_event_t *ev) { maybe_destroy_httpdmgr(httpdmgr); isc_event_free(&ev); - - EXIT("accept"); } static isc_result_t @@ -977,12 +945,9 @@ isc_httpd_recvdone(isc_task_t *task, isc_event_t *ev) { REQUIRE(VALID_HTTPD(httpd)); - ENTER("recv"); - INSIST(ISC_HTTPD_ISRECV(httpd)); if (sev->result != ISC_R_SUCCESS) { - NOTICE("recv destroying client"); goto out; } @@ -1113,7 +1078,6 @@ isc_httpd_recvdone(isc_task_t *task, isc_event_t *ev) { out: maybe_destroy_httpd(httpd); isc_event_free(&ev); - EXIT("recv"); } void @@ -1126,8 +1090,6 @@ isc_httpdmgr_shutdown(isc_httpdmgr_t **httpdmgrp) { *httpdmgrp = NULL; REQUIRE(VALID_HTTPDMGR(httpdmgr)); - ENTER("isc_httpdmgr_shutdown"); - LOCK(&httpdmgr->lock); MSETSHUTTINGDOWN(httpdmgr); @@ -1145,7 +1107,6 @@ isc_httpdmgr_shutdown(isc_httpdmgr_t **httpdmgrp) { maybe_destroy_httpdmgr(httpdmgr); - EXIT("isc_httpdmgr_shutdown"); } static isc_result_t @@ -1267,7 +1228,6 @@ isc_httpd_senddone(isc_task_t *task, isc_event_t *ev) { REQUIRE(VALID_HTTPD(httpd)); - ENTER("senddone"); INSIST(ISC_HTTPD_ISSEND(httpd)); isc_buffer_free(&httpd->sendbuffer); @@ -1285,7 +1245,6 @@ isc_httpd_senddone(isc_task_t *task, isc_event_t *ev) { b = &httpd->bodybuffer; httpd->freecb(b, httpd->freecb_arg); } - NOTICE("senddone free callback performed"); } if (sev->result != ISC_R_SUCCESS) { @@ -1298,8 +1257,6 @@ isc_httpd_senddone(isc_task_t *task, isc_event_t *ev) { ISC_HTTPD_SETRECV(httpd); - NOTICE("senddone restarting recv on socket"); - reset_client(httpd); r.base = (unsigned char *)httpd->recvbuf; @@ -1310,7 +1267,6 @@ isc_httpd_senddone(isc_task_t *task, isc_event_t *ev) { out: maybe_destroy_httpd(httpd); isc_event_free(&ev); - EXIT("senddone"); } static void