pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/28428 )
Change subject: cbsp: Avoid encoding CBSP message if link is down ......................................................................
cbsp: Avoid encoding CBSP message if link is down
Change-Id: I25c8681d2ee987ac6ebfce42ee409926eb88301d --- M src/osmo-bsc/cbsp_link.c 1 file changed, 7 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/28/28428/1
diff --git a/src/osmo-bsc/cbsp_link.c b/src/osmo-bsc/cbsp_link.c index 39798df..d8c32ec 100644 --- a/src/osmo-bsc/cbsp_link.c +++ b/src/osmo-bsc/cbsp_link.c @@ -300,6 +300,13 @@ { struct msgb *msg;
+ if (!cbc->client.cli && !cbc->server.srv) { + LOGP(DCBS, LOGL_ERROR, "Discarding Tx CBSP Message Type %s, link is down\n", + get_value_string(cbsp_msg_type_names, cbsp->msg_type)); + talloc_free(cbsp); + return 0; + } + msg = osmo_cbsp_encode(cbc, cbsp); if (!msg) { LOGP(DCBS, LOGL_ERROR, "Unable to encode CBSP Message Type %s: %s\n", @@ -311,10 +318,6 @@ osmo_stream_cli_send(cbc->client.cli, msg); else if (cbc->server.srv) osmo_stream_srv_send(cbc->server.srv, msg); - else { - LOGP(DCBS, LOGL_ERROR, "Discarding CBSP Message, link is down: %s\n", msgb_hexdump(msg)); - msgb_free(msg); - }
talloc_free(cbsp); return 0;