summaryrefslogtreecommitdiff
path: root/src/ua.c
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2016-06-05 15:01:53 +0200
committerAlfred E. Heggestad <aeh@db.org>2016-06-05 15:01:53 +0200
commit439c2f9cb452c20155d7080930e79bee978b9983 (patch)
tree37aa9bfadcb196588ceb36f983c64c5bff166d37 /src/ua.c
parent8dee67182685e7d738f4752fc60b754fd96fa35a (diff)
ua: added ua exit handler
Diffstat (limited to 'src/ua.c')
-rw-r--r--src/ua.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/ua.c b/src/ua.c
index 575c752..6c7c758 100644
--- a/src/ua.c
+++ b/src/ua.c
@@ -57,6 +57,8 @@ static struct {
bool use_tls; /**< Use TLS transport */
bool prefer_ipv6; /**< Force IPv6 transport */
sip_msg_h *subh;
+ ua_exit_h *exith; /**< UA Exit handler */
+ void *arg; /**< UA Exit handler argument */
char *eprm; /**< Extra UA parameters */
#ifdef USE_TLS
struct tls *tls; /**< TLS Context */
@@ -76,6 +78,8 @@ static struct {
false,
NULL,
NULL,
+ NULL,
+ NULL,
#ifdef USE_TLS
NULL,
#endif
@@ -98,7 +102,8 @@ static void exit_handler(void *arg)
debug("ua: sip-stack exit\n");
module_app_unload();
- re_cancel();
+ if (uag.exith)
+ uag.exith(uag.arg);
}
@@ -1454,6 +1459,20 @@ void ua_stop_all(bool forced)
/**
+ * Set the global UA exit handler. The exit handler will be called
+ * asyncronously when the SIP stack has exited.
+ *
+ * @param exith Exit handler
+ * @param arg Handler argument
+ */
+void uag_set_exit_handler(ua_exit_h *exith, void *arg)
+{
+ uag.exith = exith;
+ uag.arg = arg;
+}
+
+
+/**
* Reset the SIP transports for all User-Agents
*
* @param reg True to reset registration