Change in osmo-remsim[master]: rspro_client_fsm: Add SRVC_E_DISCONNECT to disconnect from RSPRO server

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
Sun Feb 16 14:35:12 UTC 2020


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-remsim/+/17184 )


Change subject: rspro_client_fsm: Add SRVC_E_DISCONNECT to disconnect from RSPRO server
......................................................................

rspro_client_fsm: Add SRVC_E_DISCONNECT to disconnect from RSPRO server

This is in preparation of other patches which will actually issue the
SRVC_E_DISCONNET event towards this FSM.

Related: OS#4399
Change-Id: I080f9e85987bbbe7aef84c32ce84b69d949ff561
---
M src/rspro_client_fsm.c
M src/rspro_client_fsm.h
2 files changed, 18 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/84/17184/1

diff --git a/src/rspro_client_fsm.c b/src/rspro_client_fsm.c
index d5cf04b..7df1d17 100644
--- a/src/rspro_client_fsm.c
+++ b/src/rspro_client_fsm.c
@@ -110,6 +110,7 @@
 
 static const struct value_string server_conn_fsm_event_names[] = {
 	OSMO_VALUE_STRING(SRVC_E_ESTABLISH),
+	OSMO_VALUE_STRING(SRVC_E_DISCONNECT),
 	OSMO_VALUE_STRING(SRVC_E_TCP_UP),
 	OSMO_VALUE_STRING(SRVC_E_TCP_DOWN),
 	OSMO_VALUE_STRING(SRVC_E_KA_TIMEOUT),
@@ -330,10 +331,26 @@
 
 static void srvc_allstate_action(struct osmo_fsm_inst *fi, uint32_t event, void *data)
 {
+	struct rspro_server_conn *srvc = (struct rspro_server_conn *) fi->priv;
+
 	switch (event) {
 	case SRVC_E_ESTABLISH:
 		osmo_fsm_inst_state_chg(fi, SRVC_ST_REESTABLISH, T2_RECONNECT, 2);
 		break;
+	case SRVC_E_DISCONNECT:
+		if (srvc->keepalive_fi) {
+			ipa_keepalive_fsm_stop(srvc->keepalive_fi);
+			osmo_fsm_inst_term(srvc->keepalive_fi, OSMO_FSM_TERM_REGULAR, NULL);
+			srvc->keepalive_fi = NULL;
+		}
+		if (srvc->conn) {
+			LOGPFSML(fi, LOGL_INFO, "Destroying existing connection to server\n");
+			ipa_client_conn_close(srvc->conn);
+			ipa_client_conn_destroy(srvc->conn);
+			srvc->conn = NULL;
+		}
+		osmo_fsm_inst_state_chg(fi, SRVC_ST_INIT, 0, 0);
+		break;
 	default:
 		OSMO_ASSERT(0);
 	}
diff --git a/src/rspro_client_fsm.h b/src/rspro_client_fsm.h
index 2f3f7fc..c1ae764 100644
--- a/src/rspro_client_fsm.h
+++ b/src/rspro_client_fsm.h
@@ -8,6 +8,7 @@
 
 enum server_conn_fsm_event {
 	SRVC_E_ESTABLISH,	/* instruct SRVC to (re)etablish TCP connection to bankd */
+	SRVC_E_DISCONNECT,	/* instruct SRVC to disconnect TCP connection to bankd */
 	SRVC_E_TCP_UP,
 	SRVC_E_TCP_DOWN,
 	SRVC_E_KA_TIMEOUT,

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

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I080f9e85987bbbe7aef84c32ce84b69d949ff561
Gerrit-Change-Number: 17184
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200216/bb463750/attachment.htm>


More information about the gerrit-log mailing list