The ctrl_cmds are now using struct ipa_server_conn so the pending
entries need to use it as well. This patch needs the closed_cb patch for
libosmo-abis to work.
---
 openbsc/include/openbsc/bsc_nat.h  |    2 +-
 openbsc/src/osmo-bsc_nat/bsc_nat.c |   15 ++++++++-------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/openbsc/include/openbsc/bsc_nat.h 
b/openbsc/include/openbsc/bsc_nat.h
index b4f07e0..eca019d 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -78,7 +78,7 @@ struct bsc_cmd_list {
        int nat_id;
 
        /* The control connection from which the command originated */
-       struct ctrl_connection *ccon;
+       struct ipa_server_conn *ipa_link;
 
        /* 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 326d04e..2753065 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -882,7 +882,7 @@ void bsc_close_connection(struct bsc_connection *connection)
        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->ipa_link, cmd_entry->cmd);
                bsc_del_pending(cmd_entry);
        }
 
@@ -1232,7 +1232,7 @@ static int handle_ctrlif_msg(struct bsc_connection *bsc, 
struct msgb *msg)
                                goto err;
                        }
                        cmd->id = id;
-                       ctrl_cmd_send(&pending->ccon->write_queue, cmd);
+                       ctrl_cmd_send(pending->ipa_link, cmd);
                        bsc_del_pending(pending);
                } else {
                        /* We need to handle TRAPS here */
@@ -1575,22 +1575,23 @@ static void pending_timeout_cb(void *data)
        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->ipa_link, pending->cmd);
 
        bsc_del_pending(pending);
 }
 
-static void ctrl_conn_closed_cb(struct ctrl_connection *connection)
+static int ctrl_conn_closed_cb(struct ipa_server_conn *connection)
 {
        struct bsc_connection *bsc;
        struct bsc_cmd_list *pending, *tmp;
 
        llist_for_each_entry(bsc, &nat->bsc_connections, list_entry) {
                llist_for_each_entry_safe(pending, tmp, &bsc->cmd_pending, 
list_entry) {
-                       if (pending->ccon == connection)
+                       if (pending->ipa_link == connection)
                                bsc_del_pending(pending);
                }
        }
+       return 0;
 }
 
 static int forward_to_bsc(struct ctrl_cmd *cmd)
@@ -1660,8 +1661,8 @@ static int forward_to_bsc(struct ctrl_cmd *cmd)
                                cmd->reply = "Sending failed";
                                goto err;
                        }
-                       pending->ccon = cmd->ccon;
-                       pending->ccon->closed_cb = ctrl_conn_closed_cb;
+                       pending->ipa_link = cmd->ipa_link;
+                       pending->ipa_link->closed_cb = ctrl_conn_closed_cb;
                        pending->cmd = cmd;
 
                        /* Setup the timeout */
-- 
1.7.6.1


Reply via email to