stream.c: Improve logging during sock send()
Change-Id: Iff275c809ec2bb34f471d15bfdc92296566b76a7
This commit is contained in:
parent
cb1635a6b5
commit
5ed1a3c85c
|
@ -239,8 +239,6 @@ static int osmo_stream_cli_write(struct osmo_stream_cli *cli)
|
||||||
struct llist_head *lh;
|
struct llist_head *lh;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
LOGSCLI(cli, LOGL_DEBUG, "sending data\n");
|
|
||||||
|
|
||||||
if (llist_empty(&cli->tx_queue)) {
|
if (llist_empty(&cli->tx_queue)) {
|
||||||
cli->ofd.when &= ~BSC_FD_WRITE;
|
cli->ofd.when &= ~BSC_FD_WRITE;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -254,6 +252,8 @@ static int osmo_stream_cli_write(struct osmo_stream_cli *cli)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOGSCLI(cli, LOGL_DEBUG, "sending %u bytes of data\n", msgb_length(msg));
|
||||||
|
|
||||||
switch (cli->proto) {
|
switch (cli->proto) {
|
||||||
#ifdef HAVE_LIBSCTP
|
#ifdef HAVE_LIBSCTP
|
||||||
case IPPROTO_SCTP:
|
case IPPROTO_SCTP:
|
||||||
|
@ -266,14 +266,14 @@ static int osmo_stream_cli_write(struct osmo_stream_cli *cli)
|
||||||
#endif
|
#endif
|
||||||
case IPPROTO_TCP:
|
case IPPROTO_TCP:
|
||||||
default:
|
default:
|
||||||
ret = send(cli->ofd.fd, msg->data, msg->len, 0);
|
ret = send(cli->ofd.fd, msg->data, msgb_length(msg), 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (errno == EPIPE || errno == ENOTCONN) {
|
if (errno == EPIPE || errno == ENOTCONN) {
|
||||||
osmo_stream_cli_reconnect(cli);
|
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);
|
msgb_free(msg);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue