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
This commit is contained in:
parent
3ee5274265
commit
48f9a3c27f
|
@ -288,9 +288,15 @@ static int osmo_stream_cli_write(struct osmo_stream_cli *cli)
|
|||
}
|
||||
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue