[PATCH] osmo-bsc[master]: bsc_nat: Drop redundant ccon ptr in bsc_cmd_list

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

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Wed Apr 11 15:27:30 UTC 2018


Review at  https://gerrit.osmocom.org/7760

bsc_nat: Drop redundant ccon ptr in bsc_cmd_list

It can be obtained from cmd field, so no need to store it in pending.
This way we simplify the ad-hoc struct bsc_cmd_list.

Change-Id: I6de64fc128ad623ca30b9e6cebebaff8de18f95d
---
M include/osmocom/bsc/bsc_nat.h
M src/osmo-bsc_nat/bsc_nat_ctrl.c
2 files changed, 4 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/60/7760/1

diff --git a/include/osmocom/bsc/bsc_nat.h b/include/osmocom/bsc/bsc_nat.h
index 452daf2..6146c00 100644
--- a/include/osmocom/bsc/bsc_nat.h
+++ b/include/osmocom/bsc/bsc_nat.h
@@ -70,9 +70,6 @@
 	/* The NATed ID used on the bsc_con*/
 	int nat_id;
 
-	/* The control connection from which the command originated */
-	struct ctrl_connection *ccon;
-
 	/* The command from the control connection */
 	struct ctrl_cmd *cmd;
 };
diff --git a/src/osmo-bsc_nat/bsc_nat_ctrl.c b/src/osmo-bsc_nat/bsc_nat_ctrl.c
index 5d551ac..7df3ca3 100644
--- a/src/osmo-bsc_nat/bsc_nat_ctrl.c
+++ b/src/osmo-bsc_nat/bsc_nat_ctrl.c
@@ -149,7 +149,7 @@
 				cmd->reply = "OOM";
 				goto err;
 			}
-			ctrl_cmd_send(&pending->ccon->write_queue, cmd);
+			ctrl_cmd_send(&pending->cmd->ccon->write_queue, cmd);
 			bsc_nat_ctrl_del_pending(pending);
 		} else {
 			/* We need to handle TRAPS here */
@@ -177,7 +177,7 @@
 	LOGP(DNAT, LOGL_ERROR, "Command timed out\n");
 	pending->cmd->type = CTRL_TYPE_ERROR;
 	pending->cmd->reply = "Command timed out";
-	ctrl_cmd_send(&pending->ccon->write_queue, pending->cmd);
+	ctrl_cmd_send(&pending->cmd->ccon->write_queue, pending->cmd);
 
 	bsc_nat_ctrl_del_pending(pending);
 }
@@ -189,7 +189,7 @@
 
 	llist_for_each_entry(bsc, &g_nat->bsc_connections, list_entry) {
 		llist_for_each_entry_safe(pending, tmp, &bsc->cmd_pending, list_entry) {
-			if (pending->ccon == connection)
+			if (pending->cmd->ccon == connection)
 				bsc_nat_ctrl_del_pending(pending);
 		}
 	}
@@ -276,8 +276,7 @@
 			cmd->reply = "Sending failed";
 			goto err;
 		}
-		pending->ccon = cmd->ccon;
-		pending->ccon->closed_cb = ctrl_conn_closed_cb;
+		cmd->ccon->closed_cb = ctrl_conn_closed_cb;
 		pending->cmd = cmd;
 
 		/* Setup the timeout */

-- 
To view, visit https://gerrit.osmocom.org/7760
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6de64fc128ad623ca30b9e6cebebaff8de18f95d
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list