Change in osmo-remsim[master]: rspro_client_fsm: Add optional notifiation of parent on connect/disco...

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/.

laforge gerrit-no-reply at lists.osmocom.org
Wed Mar 4 15:28:26 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-remsim/+/17336 )

Change subject: rspro_client_fsm: Add optional notifiation of parent on connect/disconnect
......................................................................

rspro_client_fsm: Add optional notifiation of parent on connect/disconnect

This will be useful once we introduce a 'main' client FSM that is a
parent to the rspro_client_fsms.

Change-Id: Ifddb8e0b5c991e5348392c9e44612669ce207bc4
---
M src/rspro_client_fsm.c
M src/rspro_client_fsm.h
2 files changed, 22 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/rspro_client_fsm.c b/src/rspro_client_fsm.c
index 2c1c029..e55892c 100644
--- a/src/rspro_client_fsm.c
+++ b/src/rspro_client_fsm.c
@@ -244,6 +244,14 @@
 	}
 }
 
+static void srvc_st_connected_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
+{
+	struct rspro_server_conn *srvc = (struct rspro_server_conn *) fi->priv;
+
+	if (fi->proc.parent)
+		osmo_fsm_inst_dispatch(fi->proc.parent, srvc->parent_conn_evt, NULL);
+}
+
 static void srvc_st_connected(struct osmo_fsm_inst *fi, uint32_t event, void *data)
 {
 	struct rspro_server_conn *srvc = (struct rspro_server_conn *) fi->priv;
@@ -263,6 +271,14 @@
 	}
 }
 
+static void srvc_st_connected_onleave(struct osmo_fsm_inst *fi, uint32_t next_state)
+{
+	struct rspro_server_conn *srvc = (struct rspro_server_conn *) fi->priv;
+
+	if (fi->proc.parent)
+		osmo_fsm_inst_dispatch(fi->proc.parent, srvc->parent_disc_evt, NULL);
+}
+
 static int ipa_kaepalive_timeout_cb(struct osmo_fsm_inst *ka_fi, void *conn)
 {
 	struct osmo_fsm_inst *fi = ka_fi->proc.parent;
@@ -396,6 +412,8 @@
 		.in_event_mask = S(SRVC_E_TCP_DOWN) | S(SRVC_E_KA_TIMEOUT) | S(SRVC_E_RSPRO_TX),
 		.out_state_mask = S(SRVC_ST_REESTABLISH) | S(SRVC_ST_INIT),
 		.action = srvc_st_connected,
+		.onenter = srvc_st_connected_onenter,
+		.onleave = srvc_st_connected_onleave,
 	},
 	[SRVC_ST_REESTABLISH] = {
 		.name = "REESTABLISH",
diff --git a/src/rspro_client_fsm.h b/src/rspro_client_fsm.h
index c1ae764..029fcd9 100644
--- a/src/rspro_client_fsm.h
+++ b/src/rspro_client_fsm.h
@@ -41,6 +41,10 @@
 	char *server_host;
 	uint16_t server_port;
 
+	/* FSM events we are to sent to the parent FSM on connect / disconnect */
+	uint32_t parent_conn_evt;
+	uint32_t parent_disc_evt;
+
 	/* only in case we are representing a bankd client */
 	struct {
 		uint16_t bank_id;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/17336
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: Ifddb8e0b5c991e5348392c9e44612669ce207bc4
Gerrit-Change-Number: 17336
Gerrit-PatchSet: 5
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200304/2066edef/attachment.htm>


More information about the gerrit-log mailing list