pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-cbc/+/28887 )
Change subject: cbsp/sbcap: Fail if trying to Tx on non-connected (connecting) link ......................................................................
cbsp/sbcap: Fail if trying to Tx on non-connected (connecting) link
This way upper layers know right away that the message could not be transmitted to that peer.
Change-Id: I1d2285d18ee064fd78191765e8cb833bf5ee08a4 --- M src/cbsp_link.c M src/sbcap_link.c 2 files changed, 10 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-cbc refs/changes/87/28887/1
diff --git a/src/cbsp_link.c b/src/cbsp_link.c index b432aad..045cfa4 100644 --- a/src/cbsp_link.c +++ b/src/cbsp_link.c @@ -327,6 +327,11 @@ get_value_string(cbsp_msg_type_names, cbsp->msg_type)); talloc_free(cbsp); return -ENOLINK; + } else if (link->is_client && !osmo_stream_cli_is_connected(link->cli_conn)) { + LOGPCC(link, LOGL_NOTICE, "Cannot transmit %s: reconnecting\n", + get_value_string(cbsp_msg_type_names, cbsp->msg_type)); + talloc_free(cbsp); + return -ENOTCONN; }
LOGPCC(link, LOGL_INFO, "Transmitting %s\n", diff --git a/src/sbcap_link.c b/src/sbcap_link.c index 9cf794b..be64ce7 100644 --- a/src/sbcap_link.c +++ b/src/sbcap_link.c @@ -394,6 +394,11 @@ sbcap_pdu_get_name(pdu)); rc = -ENOLINK; goto ret_free; + } else if (link->is_client && !osmo_stream_cli_is_connected(link->cli_conn)) { + LOGPSBCAPC(link, LOGL_NOTICE, "Cannot transmit msg %s: reconnecting\n", + sbcap_pdu_get_name(pdu)); + rc = -ENOTCONN; + goto ret_free; }
LOGPSBCAPC(link, LOGL_INFO, "Tx msg %s\n",