stream.c: Improve logging during sock send()

Change-Id: Iff275c809ec2bb34f471d15bfdc92296566b76a7
This commit is contained in:
Pau Espin 2020-01-09 20:38:05 +01:00
parent cb1635a6b5
commit 5ed1a3c85c
1 changed files with 4 additions and 4 deletions

View File

@ -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;