- fixed null-interface cleanup.
This commit is contained in:
parent
d87ba28a66
commit
5680639492
|
@ -790,10 +790,6 @@ static void interface_cleanup(struct capi_pvt *i)
|
|||
i->writerfd = -1;
|
||||
}
|
||||
|
||||
if (capi_remove_nullif(i)) {
|
||||
return;
|
||||
}
|
||||
|
||||
i->isdnstate = 0;
|
||||
i->cause = 0;
|
||||
|
||||
|
@ -824,6 +820,9 @@ static void interface_cleanup(struct capi_pvt *i)
|
|||
i->peer = NULL;
|
||||
i->owner = NULL;
|
||||
i->used = NULL;
|
||||
|
||||
capi_remove_nullif(i);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -284,7 +284,6 @@ int pbx_capi_chat(struct ast_channel *c, char *param)
|
|||
struct capi_pvt *i = NULL;
|
||||
char *roomname, *controller, *options;
|
||||
struct capichat_s *room;
|
||||
int state;
|
||||
unsigned int contr = 1;
|
||||
|
||||
roomname = strsep(¶m, "|");
|
||||
|
@ -334,13 +333,7 @@ int pbx_capi_chat(struct ast_channel *c, char *param)
|
|||
del_chat_member(room);
|
||||
|
||||
out:
|
||||
if (i->channeltype == CAPI_CHANNELTYPE_NULL) {
|
||||
cc_mutex_lock(&i->lock);
|
||||
state = i->state;
|
||||
i->state = CAPI_STATE_DISCONNECTING;
|
||||
capi_activehangup(i, state);
|
||||
cc_mutex_unlock(&i->lock);
|
||||
}
|
||||
capi_remove_nullif(i);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -79,17 +79,28 @@ void cc_verbose(int o_v, int c_d, char *text, ...)
|
|||
/*
|
||||
* hangup and remove null-interface
|
||||
*/
|
||||
int capi_remove_nullif(struct capi_pvt *i)
|
||||
void capi_remove_nullif(struct capi_pvt *i)
|
||||
{
|
||||
struct capi_pvt *ii;
|
||||
struct capi_pvt *tmp = NULL;
|
||||
int state;
|
||||
|
||||
if (i->channeltype != CAPI_CHANNELTYPE_NULL) {
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
cc_mutex_destroy(&i->lock);
|
||||
ast_cond_destroy(&i->event_trigger);
|
||||
if (i->PLCI != 0) {
|
||||
/* if the interface is in use, hangup first */
|
||||
cc_mutex_lock(&i->lock);
|
||||
|
||||
state = i->state;
|
||||
i->state = CAPI_STATE_DISCONNECTING;
|
||||
capi_activehangup(i, state);
|
||||
|
||||
cc_mutex_unlock(&i->lock);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
cc_mutex_lock(&nullif_lock);
|
||||
ii = nulliflist;
|
||||
|
@ -104,6 +115,8 @@ int capi_remove_nullif(struct capi_pvt *i)
|
|||
i->vname);
|
||||
if (i->smoother)
|
||||
ast_smoother_free(i->smoother);
|
||||
cc_mutex_destroy(&i->lock);
|
||||
ast_cond_destroy(&i->event_trigger);
|
||||
free(i);
|
||||
break;
|
||||
}
|
||||
|
@ -111,8 +124,6 @@ int capi_remove_nullif(struct capi_pvt *i)
|
|||
ii = ii->next;
|
||||
}
|
||||
cc_mutex_unlock(&nullif_lock);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -33,7 +33,7 @@ extern void capi_parse_dialstring(char *buffer, char **interface, char **dest, c
|
|||
extern char *capi_number_func(unsigned char *data, unsigned int strip, char *buf);
|
||||
extern int cc_add_peer_link_id(struct ast_channel *c);
|
||||
extern struct ast_channel *cc_get_peer_link_id(const char *p);
|
||||
extern int capi_remove_nullif(struct capi_pvt *i);
|
||||
extern void capi_remove_nullif(struct capi_pvt *i);
|
||||
extern struct capi_pvt *capi_mknullif(struct ast_channel *c, unsigned int controller);
|
||||
extern int capi_create_reader_writer_pipe(struct capi_pvt *i);
|
||||
extern struct ast_frame *capi_read_pipeframe(struct capi_pvt *i);
|
||||
|
|
Loading…
Reference in New Issue