Skip to content

Commit

Permalink
Upd: Improve webserver error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorporation committed Oct 9, 2024
1 parent 986c07f commit 078bd91
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/web_server/web_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ static void send_ws_notify_client(struct mg_mgr *mgr, struct t_work_response *re
nc = nc->next;
}
if (send_count == 0) {
MYMPD_LOG_DEBUG(NULL, "No websocket client connected, discarding message: %s", response->data);
MYMPD_LOG_DEBUG(NULL, "No websocket client with id %u connected, discarding message: %s", client_id, response->data);
}
free_response(response);
}
Expand Down Expand Up @@ -471,15 +471,12 @@ static void send_raw_response(struct mg_mgr *mgr, struct t_work_response *respon
* @param response jsonrpc response
*/
static void send_redirect(struct mg_mgr *mgr, struct t_work_response *response) {
struct mg_connection *nc = mgr->conns;
while (nc != NULL) {
if (nc->is_websocket == 0U &&
nc->id == response->conn_id)
{
webserver_send_header_redirect(nc, response->data, NULL);
break;
}
nc = nc->next;
struct mg_connection *nc = get_nc_by_id(mgr, response->conn_id);
if (nc != NULL) {
webserver_send_header_redirect(nc, response->data, NULL);
}
else {
MYMPD_LOG_ERROR(NULL, "Connection for id \"%lu\" not found", response->conn_id);
}
free_response(response);
}
Expand Down Expand Up @@ -507,6 +504,9 @@ static void send_api_response(struct mg_mgr *mgr, struct t_work_response *respon
webserver_send_data(nc, response->data, sdslen(response->data), EXTRA_HEADERS_JSON_CONTENT);
}
}
else {
MYMPD_LOG_ERROR(NULL, "Connection for id \"%lu\" not found", response->conn_id);
}
free_response(response);
}

Expand Down

0 comments on commit 078bd91

Please sign in to comment.