This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Review at https://gerrit.osmocom.org/6605
mgcp_stat: Don't print osmux stats if it is off
Otherwise we get Osmux stats during a session using RTP, which is
confusing.
Change-Id: I6fcd680a073fbf8769488ffa2b2b32098c87edf4
---
M src/libosmo-mgcp/mgcp_stat.c
M tests/mgcp/mgcp_test.c
M tests/mgcp/mgcp_test.ok
3 files changed, 19 insertions(+), 15 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/05/6605/1
diff --git a/src/libosmo-mgcp/mgcp_stat.c b/src/libosmo-mgcp/mgcp_stat.c
index 88a2d69..581130c 100644
--- a/src/libosmo-mgcp/mgcp_stat.c
+++ b/src/libosmo-mgcp/mgcp_stat.c
@@ -23,6 +23,7 @@
*/
#include <osmocom/mgcp/mgcp_stat.h>
+#include <osmocom/mgcp/mgcp_endp.h>
#include <limits.h>
/* Helper function for mgcp_format_stats_rtp() to calculate packet loss */
@@ -83,21 +84,23 @@
str += nchars;
str_len -= nchars;
- /* Error Counter */
- nchars = snprintf(str, str_len,
- "\r\nX-Osmo-CP: EC TI=%u, TO=%u",
- conn->state.in_stream.err_ts_counter,
- conn->state.out_stream.err_ts_counter);
- if (nchars < 0 || nchars >= str_len)
- goto truncate;
+ if (conn->conn->endp->cfg->osmux != OSMUX_USAGE_OFF) {
+ /* Error Counter */
+ nchars = snprintf(str, str_len,
+ "\r\nX-Osmo-CP: EC TI=%u, TO=%u",
+ conn->state.in_stream.err_ts_counter,
+ conn->state.out_stream.err_ts_counter);
+ if (nchars < 0 || nchars >= str_len)
+ goto truncate;
- str += nchars;
- str_len -= nchars;
+ str += nchars;
+ str_len -= nchars;
- if (conn->osmux.state == OSMUX_STATE_ENABLED) {
- snprintf(str, str_len,
- "\r\nX-Osmux-ST: CR=%u, BR=%u",
- conn->osmux.stats.chunks, conn->osmux.stats.octets);
+ if (conn->osmux.state == OSMUX_STATE_ENABLED) {
+ snprintf(str, str_len,
+ "\r\nX-Osmux-ST: CR=%u, BR=%u",
+ conn->osmux.stats.chunks, conn->osmux.stats.octets);
+ }
}
truncate:
diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c
index 38a0a46..e1e6290 100644
--- a/tests/mgcp/mgcp_test.c
+++ b/tests/mgcp/mgcp_test.c
@@ -314,7 +314,9 @@
#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 TI=0, TO=0\r\n"
#define RQNT \
diff --git a/tests/mgcp/mgcp_test.ok b/tests/mgcp/mgcp_test.ok
index 09ad9e1..d2879ad 100644
--- a/tests/mgcp/mgcp_test.ok
+++ b/tests/mgcp/mgcp_test.ok
@@ -569,7 +569,6 @@
---------8<---------
250 7 OK
P: PS=0, OS=0, PR=0, OR=0, PL=0, JI=0
-X-Osmo-CP: EC TI=0, TO=0
---------8<---------
Parsing result: 0
--
To view, visit https://gerrit.osmocom.org/6605
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6fcd680a073fbf8769488ffa2b2b32098c87edf4
Gerrit-PatchSet: 1
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>