[MERGED] openbsc[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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Apr 11 16:52:44 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: bsc_nat: Drop redundant ccon ptr in bsc_cmd_list
......................................................................


bsc_nat: Drop redundant ccon ptr in bsc_cmd_list

Change-Id: Ic2e4ca7d8eb4e8f71dc773b3f2c0f09709d90a94
---
M openbsc/include/openbsc/bsc_nat.h
M openbsc/src/osmo-bsc_nat/bsc_nat.c
M openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c
3 files changed, 5 insertions(+), 9 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index 94ab0e5..fad3804 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/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/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c
index f83abe1..57b51a2 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -936,7 +936,7 @@
 	llist_for_each_entry_safe(cmd_entry, cmd_tmp, &connection->cmd_pending, list_entry) {
 		cmd_entry->cmd->type = CTRL_TYPE_ERROR;
 		cmd_entry->cmd->reply = "BSC closed the connection";
-		ctrl_cmd_send(&cmd_entry->ccon->write_queue, cmd_entry->cmd);
+		ctrl_cmd_send(&cmd_entry->cmd->ccon->write_queue, cmd_entry->cmd);
 		bsc_nat_ctrl_del_pending(cmd_entry);
 	}
 
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c b/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c
index d6bf1e5..22c3608 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c
@@ -148,7 +148,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 */
@@ -176,7 +176,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);
 }
@@ -188,7 +188,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);
 		}
 	}
@@ -275,8 +275,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/7761
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic2e4ca7d8eb4e8f71dc773b3f2c0f09709d90a94
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list