[PATCH] libosmocore[master]: gsmtap_sendmsg(): clarify API doc concerning msgb ownership

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Fri Feb 16 00:36:09 UTC 2018


Review at  https://gerrit.osmocom.org/6512

gsmtap_sendmsg(): clarify API doc concerning msgb ownership

Not freeing on error does enable callers to try to re-send as well, so it is a
kind of useful feature, even though I find it likely for callers to either
forget about freeing the msg on error or double-free by accident...

I considered changing gsmtap_sendmsg() to always free, but since it is public
API, I chose to keep and document its current behavior properly instead. We
don't know what callers may exist out there.

Change-Id: Id3266ce36442024f16eaf6afa3f516d201930c41
---
M src/gsmtap_util.c
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/12/6512/1

diff --git a/src/gsmtap_util.c b/src/gsmtap_util.c
index 8f9496a..8c044b1 100644
--- a/src/gsmtap_util.c
+++ b/src/gsmtap_util.c
@@ -266,6 +266,9 @@
  *  \param[in] gti GSMTAP instance
  *  \param[in] msg message buffer
  *  \return 0 in case of success; negative in case of error
+ * NOTE: in case of nonzero return value, the *caller* must free the msg!
+ * (This enables the caller to attempt re-sending the message.)
+ * If 0 is returned, the msgb was freed by this function.
  */
 int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg)
 {

-- 
To view, visit https://gerrit.osmocom.org/6512
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id3266ce36442024f16eaf6afa3f516d201930c41
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>


More information about the gerrit-log mailing list