aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-05-02 11:07:02 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2019-05-02 11:58:49 +0200
commit133de7d87440e9a459abef0594a5d08006ff2ed6 (patch)
tree3977151f76ffb423d77404c834f14ab1bc174536
parent14616d7e589debb910db6aa409990a84dc74185a (diff)
nat: Return error code in queue_for_msc
Might be useful in the future for its callers, since sometimes actions need to be taken place based on whether enqueuing failed (and msg was freed). Change-Id: I9f172f9c9ca9db18f6adcf9267db23c73e9d5bc6
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c
index 670b0be0c..c97483aee 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -108,19 +108,23 @@ struct bsc_config *bsc_config_num(struct bsc_nat *nat, int num)
return NULL;
}
-static void queue_for_msc(struct bsc_msc_connection *con, struct msgb *msg)
+static int queue_for_msc(struct bsc_msc_connection *con, struct msgb *msg)
{
+ int rc;
if (!con) {
LOGP(DLINP, LOGL_ERROR, "No MSC Connection assigned. Check your code.\n");
msgb_free(msg);
- return;
+ return -EINVAL;
}
-
- if (osmo_wqueue_enqueue(&con->write_queue, msg) != 0) {
+ rc = osmo_wqueue_enqueue(&con->write_queue, msg);
+ if (rc != 0) {
LOGP(DLINP, LOGL_ERROR, "Failed to enqueue the write.\n");
msgb_free(msg);
+ return rc;
}
+
+ return 0;
}
static void send_reset_ack(struct bsc_connection *bsc)