[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.
This commit is contained in:
parent
3c1221e2b2
commit
b71517f07e
|
@ -105,6 +105,11 @@ int sccp_connection_send_it(struct sccp_connection *connection);
|
|||
int sccp_connection_close(struct sccp_connection *connection, int cause);
|
||||
int sccp_connection_free(struct sccp_connection *connection);
|
||||
|
||||
/**
|
||||
* internal..
|
||||
*/
|
||||
int sccp_connection_force_free(struct sccp_connection *conn);
|
||||
|
||||
/**
|
||||
* Create a new socket. Set your callbacks and then call bind to open
|
||||
* the connection.
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue