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
This commit is contained in:
Pau Espin 2022-08-01 20:56:30 +02:00
parent caba7fc493
commit 28d3a53dc5
2 changed files with 10 additions and 0 deletions

View File

@ -331,6 +331,11 @@ int cbc_cbsp_link_tx(struct cbc_cbsp_link *link, struct osmo_cbsp_decoded *cbsp)
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",

View File

@ -398,6 +398,11 @@ int cbc_sbcap_link_tx(struct cbc_sbcap_link *link, SBcAP_SBC_AP_PDU_t *pdu)
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",