pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39484?usp=email )
Change subject: MGCP_Emulation: Make sure peer is running before Tx ......................................................................
MGCP_Emulation: Make sure peer is running before Tx
This avoid DTE with "Broken pipe" if messages are being transmitted while tear down process has already started, even if components are created as "alive".
Change-Id: I8724870b9b967ffa49c3da03e1cdb2941f81653a --- M library/MGCP_Emulation.ttcn 1 file changed, 10 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/84/39484/1
diff --git a/library/MGCP_Emulation.ttcn b/library/MGCP_Emulation.ttcn index 3167579..7106f63 100644 --- a/library/MGCP_Emulation.ttcn +++ b/library/MGCP_Emulation.ttcn @@ -252,9 +252,17 @@
private function f_forward_to_client(MGCP_RecvFrom mrf, MGCP_ConnHdlr vc_conn) runs on MGCP_Emulation_CT { if (g_pars.multi_conn_mode) { - MGCP_CLIENT_MULTI.send(mrf) to vc_conn; + if (MGCP_CLIENT_MULTI.checkstate("Connected") and vc_conn.running) { + MGCP_CLIENT_MULTI.send(mrf) to vc_conn; + } else { + log("MGCP_CLIENT_MULTI: Discarding msg due to peer unavailable: ", mrf); + } } else { - MGCP_CLIENT.send(mrf.msg.command) to vc_conn; + if (MGCP_CLIENT.checkstate("Connected") and vc_conn.running) { + MGCP_CLIENT.send(mrf.msg.command) to vc_conn; + } else { + log("MGCP_CLIENT: Discarding msg due to peer unavailable: ", mrf); + } } }