From d455f9e60a07a9a0007caf1cd101369ad91f46aa Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Wed, 7 Jun 2023 17:04:42 +0200 Subject: stream: Update log messages Change-Id: Ife20b9d18e6ca86a06991d68165694e31052c58a --- src/stream.c | 16 +++++++--------- tests/stream/stream_test.err | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/stream.c b/src/stream.c index 90b793f..2e38916 100644 --- a/src/stream.c +++ b/src/stream.c @@ -281,7 +281,7 @@ void osmo_stream_cli_reconnect(struct osmo_stream_cli *cli) osmo_stream_cli_close(cli); if (cli->reconnect_timeout < 0) { - LOGSCLI(cli, LOGL_INFO, "not reconnecting, disabled.\n"); + LOGSCLI(cli, LOGL_INFO, "not reconnecting, disabled\n"); return; } @@ -395,7 +395,7 @@ static int osmo_stream_cli_write(struct osmo_stream_cli *cli) if (errno == EPIPE || errno == ENOTCONN) { osmo_stream_cli_reconnect(cli); } - LOGSCLI(cli, LOGL_ERROR, "error %d to send\n", ret); + LOGSCLI(cli, LOGL_ERROR, "received error %d in response to send\n", errno); } msgb_free(msg); @@ -439,7 +439,7 @@ static int osmo_stream_cli_fd_cb(struct osmo_fd *ofd, unsigned int what) if (llist_empty(&cli->tx_queue)) osmo_fd_write_disable(&cli->ofd); - LOGSCLI(cli, LOGL_DEBUG, "connection done.\n"); + LOGSCLI(cli, LOGL_DEBUG, "connection established\n"); cli->state = STREAM_CLI_STATE_CONNECTED; switch (cli->sk_domain) { case AF_UNIX: @@ -882,7 +882,7 @@ static void cli_timer_cb(void *data) { struct osmo_stream_cli *cli = data; - LOGSCLI(cli, LOGL_DEBUG, "reconnecting.\n"); + LOGSCLI(cli, LOGL_DEBUG, "reconnecting\n"); osmo_stream_cli_open(cli); } @@ -1319,7 +1319,7 @@ static int osmo_stream_srv_read(struct osmo_stream_srv *conn) LOGP(DLINP, LOGL_DEBUG, "message received\n"); if (conn->flags & OSMO_STREAM_SRV_F_FLUSH_DESTROY) { - LOGP(DLINP, LOGL_DEBUG, "Connection is being flushed and closed; ignoring received message\n"); + LOGP(DLINP, LOGL_INFO, "Connection is being flushed and closed; ignoring received message\n"); return 0; } @@ -1423,11 +1423,9 @@ osmo_stream_srv_create(void *ctx, struct osmo_stream_srv_link *link, OSMO_ASSERT(link); conn = talloc_zero(ctx, struct osmo_stream_srv); - if (conn == NULL) { - LOGP(DLINP, LOGL_ERROR, "cannot allocate new peer in srv, " - "reason=`%s'\n", strerror(errno)); + if (conn == NULL) return NULL; - } + conn->srv = link; osmo_fd_setup(&conn->ofd, fd, OSMO_FD_READ, osmo_stream_srv_cb, conn, 0); conn->read_cb = read_cb; diff --git a/tests/stream/stream_test.err b/tests/stream/stream_test.err index 9ed9973..ca98c82 100644 --- a/tests/stream/stream_test.err +++ b/tests/stream/stream_test.err @@ -38,6 +38,6 @@ connection closed with client {11.000018} non-reconnecting test step 1 [client OK, server OK], FD reg 1 [CONNECTED] osmo_stream_cli_recv(): connection closed with srv -[CLOSED] osmo_stream_cli_reconnect(): not reconnecting, disabled. +[CLOSED] osmo_stream_cli_reconnect(): not reconnecting, disabled {20.000019} non-reconnecting test step 0 [client OK, server OK], FD reg 0 -- cgit v1.2.3