pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-bsc/+/36576?usp=email )
Change subject: cbsp_link.c: Update stream_cli read_cb2 functions to accommodate for new
API param
......................................................................
cbsp_link.c: Update stream_cli read_cb2 functions to accommodate for new API param
libosmo-netif (not yet released) stream_cli osmo_io read_cb API was
updated to provide read result status. Hence, now API users
can account for lower layer errors and act properly, like it used to
do with the previous ofd backend.
This commit partially reverts some error code paths removed in
85687bf176e4b9663f2396a27c28b49221c72fa3 when converting code to use
osmo_io stream_cli backend.
Change-Id: I4cce5cb6ca98bc28a67dd6e927e9cdfd2312851a
Depends: libosmo-netif.git Change-Id I395c75ff1e9904757ce1d767a9ac2f779593c4c8
---
M src/osmo-bsc/cbsp_link.c
1 file changed, 37 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/76/36576/1
diff --git a/src/osmo-bsc/cbsp_link.c b/src/osmo-bsc/cbsp_link.c
index 98f25d3..20206e2 100644
--- a/src/osmo-bsc/cbsp_link.c
+++ b/src/osmo-bsc/cbsp_link.c
@@ -148,11 +148,28 @@
return 0;
}
-static int cbsp_client_read_cb(struct osmo_stream_cli *cli, struct msgb *msg)
+static int cbsp_client_read_cb(struct osmo_stream_cli *cli, int res, struct msgb *msg)
{
struct bsc_cbc_link *cbc = osmo_stream_cli_get_data(cli);
struct osmo_cbsp_decoded *decoded;
+ if (res <= 0) {
+ if (res == -EAGAIN || res == -EINTR) {
+ msgb_free(msg);
+ return 0;
+ }
+ /*
+ if (rc == -EPIPE || rc == -ECONNRESET) {
+ // lost connection
+ } else if (rc == 0) {
+ // connection closed
+ } */
+ osmo_stream_cli_reconnect(cli);
+ msgb_free(msg);
+ return -EBADF;
+ }
+
+
OSMO_ASSERT(msg);
decoded = osmo_cbsp_decode(cli, msg);
if (decoded) {
--
To view, visit
https://gerrit.osmocom.org/c/osmo-bsc/+/36576?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I4cce5cb6ca98bc28a67dd6e927e9cdfd2312851a
Gerrit-Change-Number: 36576
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange