pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/34079 ) Change subject: stream_cli: Proper handling of send() socket errors ...................................................................... stream_cli: Proper handling of send() socket errors Upon EAGAIN, simply re-enqueue the message and return waiting for next poll. Upon any other error, force close + reconnect. Related: OS#6134 Change-Id: I462cb176ebc51f3e99ee796310e8665144c84ccc --- M src/stream_cli.c 1 file changed, 22 insertions(+), 3 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/src/stream_cli.c b/src/stream_cli.c index 0e075b8..778ac43 100644 --- a/src/stream_cli.c +++ b/src/stream_cli.c @@ -288,9 +288,15 @@ } if (ret < 0) { - if (errno == EPIPE || errno == ENOTCONN) - osmo_stream_cli_reconnect(cli); - LOGSCLI(cli, LOGL_ERROR, "received error %d in response to send\n", errno); + int err = errno; + LOGSCLI(cli, LOGL_ERROR, "send(len=%u) error: %s\n", msgb_length(msg), strerror(err)); + if (err == EAGAIN) { + /* Re-add at the start of the queue to re-attempt: */ + llist_add(&msg->list, &cli->tx_queue); + return 0; + } + msgb_free(msg); + osmo_stream_cli_reconnect(cli); } msgb_free(msg); -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/34079 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I462cb176ebc51f3e99ee796310e8665144c84ccc Gerrit-Change-Number: 34079 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: osmith <osmith@sysmocom.de> Gerrit-Reviewer: pespin <pespin@sysmocom.de> Gerrit-MessageType: merged