diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-01-09 20:38:05 +0100 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-01-09 20:38:05 +0100 |
commit | 5ed1a3c85c1aa9ecbfb38cb7dd9524ff55f3cb95 (patch) | |
tree | 76c437b6a83bf154f9ce3ab55852861871d654ee | |
parent | cb1635a6b527c08c5351e5ddfa3c5fd281becfb7 (diff) |
stream.c: Improve logging during sock send()
Change-Id: Iff275c809ec2bb34f471d15bfdc92296566b76a7
-rw-r--r-- | src/stream.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/stream.c b/src/stream.c index 537fd28..fe3de2a 100644 --- a/src/stream.c +++ b/src/stream.c @@ -239,8 +239,6 @@ static int osmo_stream_cli_write(struct osmo_stream_cli *cli) struct llist_head *lh; int ret; - LOGSCLI(cli, LOGL_DEBUG, "sending data\n"); - if (llist_empty(&cli->tx_queue)) { cli->ofd.when &= ~BSC_FD_WRITE; return 0; @@ -254,6 +252,8 @@ static int osmo_stream_cli_write(struct osmo_stream_cli *cli) return 0; } + LOGSCLI(cli, LOGL_DEBUG, "sending %u bytes of data\n", msgb_length(msg)); + switch (cli->proto) { #ifdef HAVE_LIBSCTP case IPPROTO_SCTP: @@ -266,14 +266,14 @@ static int osmo_stream_cli_write(struct osmo_stream_cli *cli) #endif case IPPROTO_TCP: default: - ret = send(cli->ofd.fd, msg->data, msg->len, 0); + ret = send(cli->ofd.fd, msg->data, msgb_length(msg), 0); break; } if (ret < 0) { if (errno == EPIPE || errno == ENOTCONN) { osmo_stream_cli_reconnect(cli); } - LOGSCLI(cli, LOGL_ERROR, "error to send\n"); + LOGSCLI(cli, LOGL_ERROR, "error %d to send\n", ret); } msgb_free(msg); return 0; |