}
ast_mutex_unlock(&sub->lock);
ast_free(sub);
+ ast_module_unref(ast_module_info->self);
return 0;
}
struct skinnysession *s;
struct protoent *p;
int arg = 1;
- pthread_t tcp_thread;
for (;;) {
sinlen = sizeof(sin);
AST_LIST_INSERT_HEAD(&sessions, s, list);
AST_LIST_UNLOCK(&sessions);
- if (ast_pthread_create_detached(&tcp_thread, NULL, skinny_session, s)) {
+ if (ast_pthread_create_detached(&s->t, NULL, skinny_session, s)) {
destroy_session(s);
}
}
struct skinny_subchannel *sub;
struct ast_context *con;
+ ast_rtp_proto_unregister(&skinny_rtp);
+ ast_channel_unregister(&skinny_tech);
+ ast_cli_unregister_multiple(cli_skinny, sizeof(cli_skinny) / sizeof(struct ast_cli_entry));
+
AST_LIST_LOCK(&sessions);
/* Destroy all the interfaces and free their memory */
while((s = AST_LIST_REMOVE_HEAD(&sessions, list))) {
if (l->mwi_event_sub)
ast_event_unsubscribe(l->mwi_event_sub);
ast_mutex_unlock(&l->lock);
+ unregister_exten(l);
}
if (s->fd > -1)
close(s->fd);
+ pthread_cancel(s->t);
+ pthread_kill(s->t, SIGURG);
+ pthread_join(s->t, NULL);
free(s);
}
AST_LIST_UNLOCK(&sessions);
accept_t = AST_PTHREADT_STOP;
ast_mutex_unlock(&netlock);
- ast_rtp_proto_unregister(&skinny_rtp);
- ast_channel_unregister(&skinny_tech);
- ast_cli_unregister_multiple(cli_skinny, sizeof(cli_skinny) / sizeof(struct ast_cli_entry));
-
close(skinnysock);
if (sched)
sched_context_destroy(sched);