aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/sccp/sccp.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-05 18:13:40 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-04-05 18:15:12 +0200
commit88b614110f469e7729361a1363b8425a8e9ddde1 (patch)
tree20d3b326d063a131075226860db9b4389fc17b3d /openbsc/src/sccp/sccp.c
parentd9b825a5f5045adfdf50abe27d7bb50e6a7e0ed3 (diff)
[sccp] Add a force_free method for connections
E.g. when the underlying connection transport medium is gone one needs to force to close SCCP connections, add this helper. It will remove the connection from the list of connections and it will free the data.
Diffstat (limited to 'openbsc/src/sccp/sccp.c')
-rw-r--r--openbsc/src/sccp/sccp.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/openbsc/src/sccp/sccp.c b/openbsc/src/sccp/sccp.c
index 4bd87c8ed..e0fd02e0e 100644
--- a/openbsc/src/sccp/sccp.c
+++ b/openbsc/src/sccp/sccp.c
@@ -1198,6 +1198,17 @@ int sccp_connection_free(struct sccp_connection *connection)
return 0;
}
+int sccp_connection_force_free(struct sccp_connection *con)
+{
+ if (con->connection_state > SCCP_CONNECTION_STATE_NONE &&
+ con->connection_state < SCCP_CONNECTION_STATE_RELEASE_COMPLETE)
+ llist_del(&con->list);
+
+ con->connection_state = SCCP_CONNECTION_STATE_REFUSED;
+ sccp_connection_free(con);
+ return 0;
+}
+
struct sccp_connection *sccp_connection_socket(void)
{
return talloc_zero(tall_sccp_ctx, struct sccp_connection);