Change in openbsc[master]: nat: Return error code in queue_for_msc

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Thu May 2 09:15:49 UTC 2019


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/13840


Change subject: nat: Return error code in queue_for_msc
......................................................................

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
---
M openbsc/src/osmo-bsc_nat/bsc_nat.c
1 file changed, 8 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/40/13840/1

diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c
index 670b0be..c97483a 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -108,19 +108,23 @@
 	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)

-- 
To view, visit https://gerrit.osmocom.org/13840
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9f172f9c9ca9db18f6adcf9267db23c73e9d5bc6
Gerrit-Change-Number: 13840
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190502/d5e16c0f/attachment.html>


More information about the gerrit-log mailing list