Change in osmo-bts[master]: Revert "abis: Fix line leaked & recreated upon every reconnect"

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

pespin gerrit-no-reply at lists.osmocom.org
Thu Sep 23 21:02:07 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/25567 )

Change subject: Revert "abis: Fix line leaked & recreated upon every reconnect"
......................................................................

Revert "abis: Fix line leaked & recreated upon every reconnect"

This reverts commit bc6d35f52d4d3abd650afb05475ad5a818737fe2.

Change-Id: I15063f0156ed8910795cd5ffe045e2d0cbca6276
---
M include/osmo-bts/abis.h
M src/common/abis.c
2 files changed, 12 insertions(+), 12 deletions(-)

Approvals:
  pespin: Looks good to me, approved; Verified



diff --git a/include/osmo-bts/abis.h b/include/osmo-bts/abis.h
index d5cf634..40707cd 100644
--- a/include/osmo-bts/abis.h
+++ b/include/osmo-bts/abis.h
@@ -8,7 +8,7 @@
 
 enum abis_link_fsm_event {
 	ABIS_LINK_EV_SIGN_LINK_OML_UP,
-	ABIS_LINK_EV_SIGN_LINK_DOWN, /* data: struct e1inp_line* of link going down */
+	ABIS_LINK_EV_SIGN_LINK_DOWN,
 	ABIS_LINK_EV_VTY_RM_ADDR, /* data: struct bsc_oml_host* being removed */
 };
 
diff --git a/src/common/abis.c b/src/common/abis.c
index b734576..93635c2 100644
--- a/src/common/abis.c
+++ b/src/common/abis.c
@@ -81,6 +81,7 @@
 	struct bsc_oml_host *current_bsc;
 	struct gsm_bts *bts;
 	char *model_name;
+	int line_ctr;
 };
 
 static void reset_oml_link(struct gsm_bts *bts)
@@ -155,7 +156,15 @@
 		bts_dev_info.unit_name = bts->description;
 	bts_dev_info.location2 = priv->model_name;
 
-	line = e1inp_line_create(0, "ipa");	/* already comes with a reference "ctor" */
+	line = e1inp_line_find(priv->line_ctr);
+	if (line) {
+		e1inp_line_get2(line, __FILE__);	/* We want a new reference for returned line */
+	} else
+		line = e1inp_line_create(priv->line_ctr, "ipa");	/* already comes with a reference */
+
+	/* The abis connection may fail and we may have to try again with a different BSC (if configured). The next
+	 * attempt must happen on a different line. */
+	priv->line_ctr++;
 
 	if (!line) {
 		osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_FAILED, 0, 0);
@@ -177,17 +186,13 @@
 {
 	struct abis_link_fsm_priv *priv = fi->priv;
 	struct gsm_bts *bts = priv->bts;
-	struct e1inp_line *line;
 
 	switch (event) {
 	case ABIS_LINK_EV_SIGN_LINK_OML_UP:
 		osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_CONNECTED, 0, 0);
 		break;
 	case ABIS_LINK_EV_SIGN_LINK_DOWN:
-		line = (struct e1inp_line *)data;
 		reset_oml_link(bts);
-		/* Drop reference obtained through e1inp_line_create() to get rid of the line object: */
-		e1inp_line_put2(line, "ctor");
 		osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_WAIT_RECONNECT, OML_RETRY_TIMER, 0);
 		break;
 	default:
@@ -205,7 +210,6 @@
 	struct abis_link_fsm_priv *priv = fi->priv;
 	struct gsm_bts *bts = priv->bts;
 	struct gsm_bts_trx *trx;
-	struct e1inp_line *line = (struct e1inp_line *)data;
 	OSMO_ASSERT(event == ABIS_LINK_EV_SIGN_LINK_DOWN);
 
 	/* First remove the OML signalling link */
@@ -228,10 +232,6 @@
 		 * that TRX only. But libosmo-abis expects us to drop the entire
 		 * line when something goes wrong... */
 	}
-
-	/* Drop reference obtained through e1inp_line_create() to get rid of the line object: */
-	e1inp_line_put2(line, "ctor");
-
 	bts_model_abis_close(bts);
 	osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_WAIT_RECONNECT, OML_RETRY_TIMER, 0);
 }
@@ -395,7 +395,7 @@
 static void sign_link_down(struct e1inp_line *line)
 {
 	LOGPIL(line, DABIS, LOGL_ERROR, "Signalling link down\n");
-	osmo_fsm_inst_dispatch(g_bts->abis_link_fi, ABIS_LINK_EV_SIGN_LINK_DOWN, line);
+	osmo_fsm_inst_dispatch(g_bts->abis_link_fi, ABIS_LINK_EV_SIGN_LINK_DOWN, NULL);
 }
 
 

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I15063f0156ed8910795cd5ffe045e2d0cbca6276
Gerrit-Change-Number: 25567
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210923/ca424624/attachment.htm>


More information about the gerrit-log mailing list