1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

debug spew reduce

Signed-off-by: Andy Green <andy@warmcat.com>
This commit is contained in:
Andy Green 2016-04-23 07:14:03 +08:00
parent 2110ce9727
commit 5bf2ce193b
4 changed files with 27 additions and 23 deletions

View file

@ -1793,7 +1793,7 @@ lws_cgi(struct lws *wsi, const char * const *exec_array, int script_uri_path_len
wsi->hdr_state = LCHS_HEADER;
/* add us to the pt list of active cgis */
lwsl_notice("%s: adding cgi %p to list\n", __func__, wsi->cgi);
lwsl_debug("%s: adding cgi %p to list\n", __func__, wsi->cgi);
cgi->cgi_list = pt->cgi_list;
pt->cgi_list = cgi;
@ -1891,8 +1891,8 @@ lws_cgi(struct lws *wsi, const char * const *exec_array, int script_uri_path_len
env_array[n++] = p;
p += snprintf(p, end - p, "%s=%s", mp_cgienv->name,
mp_cgienv->value);
lwsl_notice(" Applying mount-specific cgi env '%s'\n",
env_array[n - 1]);
lwsl_debug(" Applying mount-specific cgi env '%s'\n",
env_array[n - 1]);
p++;
mp_cgienv = mp_cgienv->next;
}
@ -1932,7 +1932,7 @@ lws_cgi(struct lws *wsi, const char * const *exec_array, int script_uri_path_len
if (cgi->pid) {
/* we are the parent process */
wsi->context->count_cgi_spawned++;
lwsl_notice("%s: cgi %p spawned PID %d\n", __func__, cgi, cgi->pid);
lwsl_debug("%s: cgi %p spawned PID %d\n", __func__, cgi, cgi->pid);
return 0;
}
@ -2073,7 +2073,7 @@ lws_cgi_write_split_stdout_headers(struct lws *wsi)
case LCHS_SINGLE_0A:
m = wsi->hdr_state;
if (c == '\x0a') {
lwsl_err("Content-Length: %ld\n", wsi->cgi->content_length);
lwsl_debug("Content-Length: %ld\n", wsi->cgi->content_length);
wsi->hdr_state = LHCS_PAYLOAD;
/* drop the \0xa ... finalize will add it if needed */
lws_finalize_http_header(wsi,
@ -2149,13 +2149,13 @@ lws_cgi_kill(struct lws *wsi)
if (wsi->cgi->pid > 0) {
n = waitpid(wsi->cgi->pid, &status, WNOHANG);
if (n > 0) {
lwsl_notice("%s: PID %d reaped\n", __func__,
lwsl_debug("%s: PID %d reaped\n", __func__,
wsi->cgi->pid);
goto handled;
}
/* kill the process group */
n = kill(-wsi->cgi->pid, SIGTERM);
lwsl_notice("%s: SIGTERM child PID %d says %d (errno %d)\n", __func__,
lwsl_debug("%s: SIGTERM child PID %d says %d (errno %d)\n", __func__,
wsi->cgi->pid, n, errno);
if (n < 0) {
/*
@ -2180,11 +2180,11 @@ lws_cgi_kill(struct lws *wsi)
while (n > 0) {
n = waitpid(-wsi->cgi->pid, &status, WNOHANG);
if (n > 0)
lwsl_notice("%s: reaped PID %d\n", __func__, n);
lwsl_debug("%s: reaped PID %d\n", __func__, n);
if (n <= 0) {
n = waitpid(wsi->cgi->pid, &status, WNOHANG);
if (n > 0)
lwsl_notice("%s: reaped PID %d\n", __func__, n);
lwsl_debug("%s: reaped PID %d\n", __func__, n);
}
}
}
@ -2216,7 +2216,7 @@ lws_cgi_kill_terminated(struct lws_context_per_thread *pt)
n = waitpid(-1, &status, WNOHANG | WNOWAIT);
if (n <= 0)
continue;
lwsl_notice("%s: observed PID %d terminated\n", __func__, n);
lwsl_debug("%s: observed PID %d terminated\n", __func__, n);
pcgi = &pt->cgi_list;
@ -2233,9 +2233,10 @@ lws_cgi_kill_terminated(struct lws_context_per_thread *pt)
if (cgi->content_length > cgi->content_length_seen)
continue;
if (cgi->content_length)
lwsl_notice("%s: wsi %p: expected content length seen: %ld\n",
if (cgi->content_length) {
lwsl_debug("%s: wsi %p: expected content length seen: %ld\n",
__func__, cgi->wsi, cgi->content_length_seen);
}
/* reap it */
waitpid(n, &status, WNOHANG);
@ -2245,7 +2246,7 @@ lws_cgi_kill_terminated(struct lws_context_per_thread *pt)
* and close him if he's not already closing
*/
if (n == cgi->pid) {
lwsl_notice("%s: found PID %d on cgi list\n",
lwsl_debug("%s: found PID %d on cgi list\n",
__func__, n);
/* defeat kill() */
cgi->pid = 0;
@ -2257,7 +2258,7 @@ lws_cgi_kill_terminated(struct lws_context_per_thread *pt)
}
/* if not found on the cgi list, as he's one of ours, reap */
if (!cgi) {
lwsl_notice("%s: reading PID %d although no cgi match\n",
lwsl_debug("%s: reading PID %d although no cgi match\n",
__func__, n);
waitpid(n, &status, WNOHANG);
}
@ -2280,14 +2281,15 @@ lws_cgi_kill_terminated(struct lws_context_per_thread *pt)
if (cgi->content_length > cgi->content_length_seen)
continue;
if (cgi->content_length)
lwsl_notice("%s: wsi %p: expected content length seen: %ld\n",
if (cgi->content_length) {
lwsl_debug("%s: wsi %p: expected content length seen: %ld\n",
__func__, cgi->wsi, cgi->content_length_seen);
}
/* reap it */
if (waitpid(cgi->pid, &status, WNOHANG) > 0) {
lwsl_notice("%s: found PID %d on cgi list\n",
lwsl_debug("%s: found PID %d on cgi list\n",
__func__, cgi->pid);
/* defeat kill() */
cgi->pid = 0;

View file

@ -647,7 +647,7 @@ lws_ssl_capable_read_no_ssl(struct lws *wsi, unsigned char *buf, int len)
LWS_ERRNO == LWS_EINTR)
return LWS_SSL_CAPABLE_MORE_SERVICE;
#endif
lwsl_warn("error on reading from skt\n");
lwsl_debug("error on reading from skt\n");
return LWS_SSL_CAPABLE_ERROR;
}

View file

@ -277,8 +277,8 @@ int lws_http_serve(struct lws *wsi, char *uri, const char *origin)
*/
if (!strcmp(sym, lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_IF_NONE_MATCH))) {
lwsl_notice("%s: ETAG match %s %s\n", __func__,
uri, origin);
lwsl_debug("%s: ETAG match %s %s\n", __func__,
uri, origin);
/* we don't need to send the payload */
if (lws_add_http_header_status(wsi, 304, &p, end))
@ -594,7 +594,7 @@ lws_http_action(struct lws *wsi)
"http://", "https://"
};
lwsl_notice("Doing 301 '%s' org %s\n", s, hit->origin);
lwsl_debug("Doing 301 '%s' org %s\n", s, hit->origin);
if (!lws_hdr_total_length(wsi, WSI_TOKEN_HOST))
goto bail_nuke_ah;

View file

@ -327,7 +327,9 @@ lws_service_timeout_check(struct lws *wsi, unsigned int sec)
*/
if ((time_t)sec > wsi->pending_timeout_limit) {
#if LWS_POSIX
lwsl_notice("wsi %p: TIMEDOUT WAITING on %d (did hdr %d, ah %p, wl %d, pfd events %d)\n",
/* no need to log normal idle keepalive timeout */
if (wsi->pending_timeout != PENDING_TIMEOUT_HTTP_KEEPALIVE_IDLE)
lwsl_notice("wsi %p: TIMEDOUT WAITING on %d (did hdr %d, ah %p, wl %d, pfd events %d)\n",
(void *)wsi, wsi->pending_timeout,
wsi->hdr_parsing_completed, wsi->u.hdr.ah,
pt->ah_wait_list_length,
@ -492,7 +494,7 @@ lws_http_client_read(struct lws *wsi, char **buf, int *len)
{
int rlen, n;
rlen = lws_ssl_capable_read(wsi, (unsigned char *)*buf, *len);
if (rlen < 0)