[MERGED] osmo-mgw[master]: legacy: mgcp_protocol: Don't print osmux stats if it is off

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Tue Feb 20 15:27:55 UTC 2018


Pau Espin Pedrol has submitted this change and it was merged.

Change subject: legacy: mgcp_protocol: Don't print osmux stats if it is off
......................................................................


legacy: mgcp_protocol: Don't print osmux stats if it is off

Otherwise we get Osmux stats during a session using RTP, which is
confusing.

Forward-ported from openbsc e39e18992a3b966581f06fa632d6342643996aaa.

Change-Id: I9031350242dd37ce255631c20eed33976887faa6
---
M src/libosmo-legacy-mgcp/mgcp_protocol.c
M tests/legacy_mgcp/mgcp_test.c
2 files changed, 21 insertions(+), 17 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/libosmo-legacy-mgcp/mgcp_protocol.c b/src/libosmo-legacy-mgcp/mgcp_protocol.c
index d2df5f7..4e82233 100644
--- a/src/libosmo-legacy-mgcp/mgcp_protocol.c
+++ b/src/libosmo-legacy-mgcp/mgcp_protocol.c
@@ -1588,24 +1588,26 @@
 	msg += nchars;
 	size -= nchars;
 
-	/* Error Counter */
-	nchars = snprintf(msg, size,
-			  "\r\nX-Osmo-CP: EC TIS=%u, TOS=%u, TIR=%u, TOR=%u",
-			  endp->net_state.in_stream.err_ts_counter,
-			  endp->net_state.out_stream.err_ts_counter,
-			  endp->bts_state.in_stream.err_ts_counter,
-			  endp->bts_state.out_stream.err_ts_counter);
-	if (nchars < 0 || nchars >= size)
-		goto truncate;
+	if (endp->cfg->osmux != OSMUX_USAGE_OFF) {
+		/* Error Counter */
+		nchars = snprintf(msg, size,
+				  "\r\nX-Osmo-CP: EC TIS=%u, TOS=%u, TIR=%u, TOR=%u",
+				  endp->net_state.in_stream.err_ts_counter,
+				  endp->net_state.out_stream.err_ts_counter,
+				  endp->bts_state.in_stream.err_ts_counter,
+				  endp->bts_state.out_stream.err_ts_counter);
+		if (nchars < 0 || nchars >= size)
+			goto truncate;
 
-	msg += nchars;
-	size -= nchars;
+		msg += nchars;
+		size -= nchars;
 
-	if (endp->osmux.state == OSMUX_STATE_ENABLED) {
-		snprintf(msg, size,
-			 "\r\nX-Osmux-ST: CR=%u, BR=%u",
-			 endp->osmux.stats.chunks,
-			 endp->osmux.stats.octets);
+		if (endp->osmux.state == OSMUX_STATE_ENABLED) {
+			snprintf(msg, size,
+				 "\r\nX-Osmux-ST: CR=%u, BR=%u",
+				 endp->osmux.stats.chunks,
+				 endp->osmux.stats.octets);
+		}
 	}
 truncate:
 	msg[size - 1] = '\0';
diff --git a/tests/legacy_mgcp/mgcp_test.c b/tests/legacy_mgcp/mgcp_test.c
index a540b5f..1a4513e 100644
--- a/tests/legacy_mgcp/mgcp_test.c
+++ b/tests/legacy_mgcp/mgcp_test.c
@@ -268,7 +268,9 @@
 		 "C: 2\r\n"
 
 #define DLCX_RET "250 7 OK\r\n"			\
-		 "P: PS=0, OS=0, PR=0, OR=0, PL=0, JI=0\r\n" \
+		 "P: PS=0, OS=0, PR=0, OR=0, PL=0, JI=0\r\n"
+
+ #define DLCX_RET_OSMUX DLCX_RET                 \
 		 "X-Osmo-CP: EC TIS=0, TOS=0, TIR=0, TOR=0\r\n"
 
 #define RQNT	 "RQNT 186908780 1 at mgw MGCP 1.0\r\n"	\

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9031350242dd37ce255631c20eed33976887faa6
Gerrit-PatchSet: 1
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>


More information about the gerrit-log mailing list