Change in osmo-cbc[master]: message / peer FSM: fix completion detection + timeout logic

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 Jan 6 12:28:47 UTC 2021


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

Change subject: message / peer FSM: fix completion detection + timeout logic
......................................................................

message / peer FSM: fix completion detection + timeout logic

* when the message_peer FSM times out, we msut notify the message_fsm
* when waiting for DELETE_ACK, require all message_peer FSM instances to
  enter DELETE state before signaling completion

Change-Id: Ibff5e25ebb34843c4b3165329f432892ac6a6ef5
---
M src/smscb_message_fsm.c
M src/smscb_peer_fsm.c
2 files changed, 9 insertions(+), 5 deletions(-)

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



diff --git a/src/smscb_message_fsm.c b/src/smscb_message_fsm.c
index 48191d1..65a749b 100644
--- a/src/smscb_message_fsm.c
+++ b/src/smscb_message_fsm.c
@@ -66,7 +66,7 @@
 		 * timed out */
 		llist_for_each_entry(peer_fi, &fi->proc.children, proc.child) {
 			if (peer_fi->state == SMSCB_S_WAIT_WRITE_ACK)
-				break;
+				return;
 		}
 		rest_it_op_set_http_result(cbcmsg->it_op, 201, "Created"); // FIXME: error cases
 		osmo_fsm_inst_state_chg(fi, SMSCB_S_ACTIVE, 0, 0);
@@ -125,7 +125,7 @@
 	case SMSCB_E_CBSP_REPLACE_NACK:
 		llist_for_each_entry(peer_fi, &fi->proc.children, proc.child) {
 			if (peer_fi->state == SMSCB_S_WAIT_REPLACE_ACK)
-				break;
+				return;
 		}
 		rest_it_op_set_http_result(cbcmsg->it_op, 200, "OK"); // FIXME: error cases
 		osmo_fsm_inst_state_chg(fi, SMSCB_S_ACTIVE, 0, 0);
@@ -153,7 +153,7 @@
 	case SMSCB_E_CBSP_STATUS_NACK:
 		llist_for_each_entry(peer_fi, &fi->proc.children, proc.child) {
 			if (peer_fi->state == SMSCB_S_WAIT_STATUS_ACK)
-				break;
+				return;
 		}
 		rest_it_op_set_http_result(cbcmsg->it_op, 200, "OK"); // FIXME: error cases
 		osmo_fsm_inst_state_chg(fi, SMSCB_S_ACTIVE, 0, 0);
@@ -180,8 +180,8 @@
 	case SMSCB_E_CBSP_DELETE_ACK:
 	case SMSCB_E_CBSP_DELETE_NACK:
 		llist_for_each_entry(peer_fi, &fi->proc.children, proc.child) {
-			if (peer_fi->state == SMSCB_S_WAIT_DELETE_ACK)
-				break;
+			if (peer_fi->state != SMSCB_S_DELETED)
+				return;
 		}
 		rest_it_op_set_http_result(cbcmsg->it_op, 200, "OK"); // FIXME: error cases
 		osmo_fsm_inst_state_chg(fi, SMSCB_S_DELETED, 0, 0);
diff --git a/src/smscb_peer_fsm.c b/src/smscb_peer_fsm.c
index 69b4418..341c205 100644
--- a/src/smscb_peer_fsm.c
+++ b/src/smscb_peer_fsm.c
@@ -434,15 +434,19 @@
 	switch (fi->T) {
 	case T_WAIT_WRITE_ACK:
 		osmo_fsm_inst_state_chg(fi, SMSCB_S_ACTIVE, 0, 0);
+		osmo_fsm_inst_dispatch(fi->proc.parent, SMSCB_E_CBSP_WRITE_NACK, NULL);
 		break;
 	case T_WAIT_REPLACE_ACK:
 		osmo_fsm_inst_state_chg(fi, SMSCB_S_ACTIVE, 0, 0);
+		osmo_fsm_inst_dispatch(fi->proc.parent, SMSCB_E_CBSP_REPLACE_NACK, NULL);
 		break;
 	case T_WAIT_STATUS_ACK:
 		osmo_fsm_inst_state_chg(fi, SMSCB_S_ACTIVE, 0, 0);
+		osmo_fsm_inst_dispatch(fi->proc.parent, SMSCB_E_CBSP_STATUS_NACK, NULL);
 		break;
 	case T_WAIT_DELETE_ACK:
 		osmo_fsm_inst_state_chg(fi, SMSCB_S_DELETED, 0, 0);
+		osmo_fsm_inst_dispatch(fi->proc.parent, SMSCB_E_CBSP_DELETE_NACK, NULL);
 		break;
 	default:
 		OSMO_ASSERT(0);

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

Gerrit-Project: osmo-cbc
Gerrit-Branch: master
Gerrit-Change-Id: Ibff5e25ebb34843c4b3165329f432892ac6a6ef5
Gerrit-Change-Number: 21926
Gerrit-PatchSet: 3
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/20210106/ac5ffb76/attachment.htm>


More information about the gerrit-log mailing list