[PATCH] openbsc[master]: mgcp_protocol: Don't print osmux stats if it is off

2018-02-19 Thread Pau Espin Pedrol
Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/6599

to look at the new patch set (#2).

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

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

Change-Id: I814b2051edc85ad5cbd04c96b785c208f6606683
---
M openbsc/src/libmgcp/mgcp_protocol.c
M openbsc/tests/mgcp/mgcp_test.c
2 files changed, 21 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/99/6599/2

diff --git a/openbsc/src/libmgcp/mgcp_protocol.c 
b/openbsc/src/libmgcp/mgcp_protocol.c
index 7cc6256..ae5c90b 100644
--- a/openbsc/src/libmgcp/mgcp_protocol.c
+++ b/openbsc/src/libmgcp/mgcp_protocol.c
@@ -1548,24 +1548,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/openbsc/tests/mgcp/mgcp_test.c b/openbsc/tests/mgcp/mgcp_test.c
index 43a453a..570a0c9 100644
--- a/openbsc/tests/mgcp/mgcp_test.c
+++ b/openbsc/tests/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@mgw MGCP 1.0\r\n"\

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I814b2051edc85ad5cbd04c96b785c208f6606683
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder


[PATCH] openbsc[master]: mgcp_protocol: Don't print osmux stats if it is off

2018-02-19 Thread Pau Espin Pedrol

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

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

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

Change-Id: I814b2051edc85ad5cbd04c96b785c208f6606683
---
M openbsc/src/libmgcp/mgcp_protocol.c
1 file changed, 18 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/99/6599/1

diff --git a/openbsc/src/libmgcp/mgcp_protocol.c 
b/openbsc/src/libmgcp/mgcp_protocol.c
index 7cc6256..ba6164a 100644
--- a/openbsc/src/libmgcp/mgcp_protocol.c
+++ b/openbsc/src/libmgcp/mgcp_protocol.c
@@ -1548,24 +1548,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 (p->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';

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I814b2051edc85ad5cbd04c96b785c208f6606683
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol