Skip to content

Commit 0590cbf

Browse files
committed
Reduce raftable verbosity.
1 parent 13a25d7 commit 0590cbf

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

contrib/raftable/worker.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static int create_listening_socket(const char *host, int port)
107107
setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char const*)&optval, sizeof(optval));
108108
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char const*)&optval, sizeof(optval));
109109

110-
fprintf(stderr, "binding tcp %s:%d\n", host, port);
110+
elog(DEBUG1, "binding tcp %s:%d\n", host, port);
111111
if (bind(s, a->ai_addr, a->ai_addrlen) < 0)
112112
{
113113
elog(WARNING, "cannot bind the listening socket: %s", strerror(errno));
@@ -133,7 +133,7 @@ static bool add_client(int sock)
133133

134134
if (server.clientnum >= MAX_CLIENTS)
135135
{
136-
fprintf(stderr, "client limit hit\n");
136+
elog(WARNING, "client limit hit\n");
137137
return false;
138138
}
139139

@@ -193,17 +193,17 @@ static bool accept_client(void)
193193
{
194194
int fd;
195195

196-
fprintf(stderr, "a new connection is queued\n");
196+
elog(DEBUG1, "a new connection is queued\n");
197197

198198
fd = accept(server.listener, NULL, NULL);
199199
if (fd == -1) {
200-
fprintf(stderr, "failed to accept a connection: %s\n", strerror(errno));
200+
elog(WARNING, "failed to accept a connection: %s\n", strerror(errno));
201201
return false;
202202
}
203-
fprintf(stderr, "a new connection fd=%d accepted\n", fd);
203+
elog(DEBUG1, "a new connection fd=%d accepted\n", fd);
204204

205205
if (!raft_is_leader(raft)) {
206-
fprintf(stderr, "not a leader, disconnecting the accepted connection fd=%d\n", fd);
206+
elog(DEBUG1, "not a leader, disconnecting the accepted connection fd=%d\n", fd);
207207
close(fd);
208208
return false;
209209
}
@@ -256,7 +256,6 @@ static void on_message_recv(Client *c)
256256
key = f->data;
257257

258258
value = state_get(state, key, &vallen);
259-
fprintf(stderr, "query='%s' answer(%d)='%.*s'\n", key, (int)vallen, (int)vallen, value);
260259
answer = make_single_value_message(key, value, vallen, &answersize);
261260
answer->meaning = MEAN_OK;
262261
if (value) pfree(value);
@@ -270,7 +269,7 @@ static void on_message_recv(Client *c)
270269
}
271270
else
272271
{
273-
fprintf(stderr, "unknown meaning %d (%c) of the client's message\n", rm->meaning, rm->meaning);
272+
elog(WARNING, "unknown meaning %d (%c) of the client's message\n", rm->meaning, rm->meaning);
274273
c->state = CLIENT_SICK;
275274
}
276275
}
@@ -280,7 +279,6 @@ static void on_message_send(Client *c)
280279
Assert(c->state == CLIENT_RECVING);
281280
Assert(c->msg != NULL);
282281
Assert(c->cursor == c->msg->len + sizeof(c->msg->len));
283-
fprintf(stderr, "freeing msg = %p\n", c->msg);
284282
pfree(c->msg);
285283
c->msg = NULL;
286284
c->state = CLIENT_SENDING;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy