Commit 9dd00dfa authored by Max Kellermann's avatar Max Kellermann

client: removed duplicate "client" string from log

Since we introduced a GLib logging domain, the "client" string appears twice in the log lines: client: client 0: command returned 0 Removed the second one, now it looks like this: client: [0] command returned 0 Still not quite good, but better than before.
parent 53271e8a
...@@ -246,7 +246,7 @@ static void client_close(struct client *client) ...@@ -246,7 +246,7 @@ static void client_close(struct client *client)
g_queue_free(client->deferred_send); g_queue_free(client->deferred_send);
g_log(G_LOG_DOMAIN, LOG_LEVEL_SECURE, g_log(G_LOG_DOMAIN, LOG_LEVEL_SECURE,
"client %i: closed", client->num); "[%u] closed", client->num);
g_free(client); g_free(client);
} }
...@@ -309,7 +309,7 @@ void client_new(int fd, const struct sockaddr *addr, int uid) ...@@ -309,7 +309,7 @@ void client_new(int fd, const struct sockaddr *addr, int uid)
client_init(client, fd); client_init(client, fd);
client->uid = uid; client->uid = uid;
g_log(G_LOG_DOMAIN, LOG_LEVEL_SECURE, g_log(G_LOG_DOMAIN, LOG_LEVEL_SECURE,
"client %i: opened from %s\n", client->num, "[%u] opened from %s", client->num,
sockaddr_to_tmp_string(addr)); sockaddr_to_tmp_string(addr));
} }
...@@ -333,14 +333,14 @@ static int client_process_line(struct client *client, char *line) ...@@ -333,14 +333,14 @@ static int client_process_line(struct client *client, char *line)
} else if (client->idle_waiting) { } else if (client->idle_waiting) {
/* during idle mode, clients must not send anything /* during idle mode, clients must not send anything
except "noidle" */ except "noidle" */
g_warning("client %i: command \"%s\" during idle", g_warning("[%u] command \"%s\" during idle",
client->num, line); client->num, line);
return COMMAND_RETURN_CLOSE; return COMMAND_RETURN_CLOSE;
} }
if (client->cmd_list_OK >= 0) { if (client->cmd_list_OK >= 0) {
if (strcmp(line, CLIENT_LIST_MODE_END) == 0) { if (strcmp(line, CLIENT_LIST_MODE_END) == 0) {
g_debug("client %i: process command list", g_debug("[%u] process command list",
client->num); client->num);
/* for scalability reasons, we have prepended /* for scalability reasons, we have prepended
...@@ -351,7 +351,7 @@ static int client_process_line(struct client *client, char *line) ...@@ -351,7 +351,7 @@ static int client_process_line(struct client *client, char *line)
ret = command_process_list(client, ret = command_process_list(client,
client->cmd_list_OK, client->cmd_list_OK,
client->cmd_list); client->cmd_list);
g_debug("client %i: process command " g_debug("[%u] process command "
"list returned %i", client->num, ret); "list returned %i", client->num, ret);
if (ret == COMMAND_RETURN_CLOSE || if (ret == COMMAND_RETURN_CLOSE ||
...@@ -370,7 +370,7 @@ static int client_process_line(struct client *client, char *line) ...@@ -370,7 +370,7 @@ static int client_process_line(struct client *client, char *line)
client->cmd_list_size += len; client->cmd_list_size += len;
if (client->cmd_list_size > if (client->cmd_list_size >
client_max_command_list_size) { client_max_command_list_size) {
g_warning("client %i: command list size (%lu) " g_warning("[%u] command list size (%lu) "
"is larger than the max (%lu)", "is larger than the max (%lu)",
client->num, client->num,
(unsigned long)client->cmd_list_size, (unsigned long)client->cmd_list_size,
...@@ -387,10 +387,10 @@ static int client_process_line(struct client *client, char *line) ...@@ -387,10 +387,10 @@ static int client_process_line(struct client *client, char *line)
client->cmd_list_OK = 1; client->cmd_list_OK = 1;
ret = 1; ret = 1;
} else { } else {
g_debug("client %i: process command \"%s\"", g_debug("[%u] process command \"%s\"",
client->num, line); client->num, line);
ret = command_process(client, line); ret = command_process(client, line);
g_debug("client %i: command returned %i", g_debug("[%u] command returned %i",
client->num, ret); client->num, ret);
if (ret == COMMAND_RETURN_CLOSE || if (ret == COMMAND_RETURN_CLOSE ||
...@@ -444,7 +444,7 @@ static int client_input_received(struct client *client, size_t bytesRead) ...@@ -444,7 +444,7 @@ static int client_input_received(struct client *client, size_t bytesRead)
the beginning */ the beginning */
if (client->bufferLength == sizeof(client->buffer)) { if (client->bufferLength == sizeof(client->buffer)) {
if (client->bufferPos == 0) { if (client->bufferPos == 0) {
g_warning("client %i: buffer overflow", g_warning("[%u] buffer overflow",
client->num); client->num);
return COMMAND_RETURN_CLOSE; return COMMAND_RETURN_CLOSE;
} }
...@@ -628,13 +628,13 @@ client_check_expired_callback(gpointer data, G_GNUC_UNUSED gpointer user_data) ...@@ -628,13 +628,13 @@ client_check_expired_callback(gpointer data, G_GNUC_UNUSED gpointer user_data)
struct client *client = data; struct client *client = data;
if (client_is_expired(client)) { if (client_is_expired(client)) {
g_debug("client %i: expired", client->num); g_debug("[%u] expired", client->num);
client_close(client); client_close(client);
} else if (!client->idle_waiting && /* idle clients } else if (!client->idle_waiting && /* idle clients
never expire */ never expire */
time(NULL) - client->lastTime > time(NULL) - client->lastTime >
client_timeout) { client_timeout) {
g_debug("client %i: timeout", client->num); g_debug("[%u] timeout", client->num);
client_close(client); client_close(client);
} }
} }
...@@ -718,7 +718,7 @@ static void client_write_deferred(struct client *client) ...@@ -718,7 +718,7 @@ static void client_write_deferred(struct client *client)
} }
if (g_queue_is_empty(client->deferred_send)) { if (g_queue_is_empty(client->deferred_send)) {
g_debug("client %i: buffer empty %lu", client->num, g_debug("[%u] buffer empty %lu", client->num,
(unsigned long)client->deferred_bytes); (unsigned long)client->deferred_bytes);
assert(client->deferred_bytes == 0); assert(client->deferred_bytes == 0);
} }
...@@ -735,7 +735,7 @@ static void client_defer_output(struct client *client, ...@@ -735,7 +735,7 @@ static void client_defer_output(struct client *client,
alloc = sizeof(*buf) - sizeof(buf->data) + length; alloc = sizeof(*buf) - sizeof(buf->data) + length;
client->deferred_bytes += alloc; client->deferred_bytes += alloc;
if (client->deferred_bytes > client_max_output_buffer_size) { if (client->deferred_bytes > client_max_output_buffer_size) {
g_warning("client %i: output buffer size (%lu) is " g_warning("[%u] output buffer size (%lu) is "
"larger than the max (%lu)", "larger than the max (%lu)",
client->num, client->num,
(unsigned long)client->deferred_bytes, (unsigned long)client->deferred_bytes,
...@@ -790,7 +790,7 @@ static void client_write_direct(struct client *client, ...@@ -790,7 +790,7 @@ static void client_write_direct(struct client *client,
length - bytes_written); length - bytes_written);
if (!g_queue_is_empty(client->deferred_send)) if (!g_queue_is_empty(client->deferred_send))
g_debug("client %i: buffer created", client->num); g_debug("[%u] buffer created", client->num);
} }
static void client_write_output(struct client *client) static void client_write_output(struct client *client)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment