本文整理汇总了C++中pj_list_erase函数的典型用法代码示例。如果您正苦于以下问题:C++ pj_list_erase函数的具体用法?C++ pj_list_erase怎么用?C++ pj_list_erase使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pj_list_erase函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: destroy_tdata
static void destroy_tdata(pj_stun_tx_data *tdata, pj_bool_t force)
{
TRACE_((THIS_FILE, "tdata %p destroy request, force=%d, tsx=%p", tdata,
force, tdata->client_tsx));
if (tdata->res_timer.id != PJ_FALSE) {
pj_timer_heap_cancel_if_active(tdata->sess->cfg->timer_heap,
&tdata->res_timer, PJ_FALSE);
pj_list_erase(tdata);
}
if (force) {
pj_list_erase(tdata);
if (tdata->client_tsx) {
pj_stun_client_tsx_stop(tdata->client_tsx);
pj_stun_client_tsx_set_data(tdata->client_tsx, NULL);
}
pj_pool_release(tdata->pool);
} else {
if (tdata->client_tsx) {
/* "Probably" this is to absorb retransmission */
pj_time_val delay = {0, 300};
pj_stun_client_tsx_schedule_destroy(tdata->client_tsx, &delay);
} else {
pj_pool_release(tdata->pool);
}
}
}
示例2: PJ_DEF
PJ_DEF(pj_status_t) pj_grp_lock_add_ref_dbg(pj_grp_lock_t *glock,
const char *file,
int line)
{
grp_lock_ref *ref;
pj_status_t status;
pj_enter_critical_section();
if (!pj_list_empty(&glock->ref_free_list)) {
ref = glock->ref_free_list.next;
pj_list_erase(ref);
} else {
ref = PJ_POOL_ALLOC_T(glock->pool, grp_lock_ref);
}
ref->file = file;
ref->line = line;
pj_list_push_back(&glock->ref_list, ref);
pj_leave_critical_section();
status = grp_lock_add_ref(glock);
if (status != PJ_SUCCESS) {
pj_enter_critical_section();
pj_list_erase(ref);
pj_list_push_back(&glock->ref_free_list, ref);
pj_leave_critical_section();
}
return status;
}
示例3: PJ_DEF
/*
* pj_ioqueue_post_completion()
*/
PJ_DEF(pj_status_t) pj_ioqueue_post_completion( pj_ioqueue_key_t *key,
pj_ioqueue_op_key_t *op_key,
pj_ssize_t bytes_status )
{
struct generic_operation *op_rec;
/*
* Find the operation key in all pending operation list to
* really make sure that it's still there; then call the callback.
*/
pj_mutex_lock(key->mutex);
/* Find the operation in the pending read list. */
op_rec = (struct generic_operation*)key->read_list.next;
while (op_rec != (void*)&key->read_list) {
if (op_rec == (void*)op_key) {
pj_list_erase(op_rec);
op_rec->op = PJ_IOQUEUE_OP_NONE;
pj_mutex_unlock(key->mutex);
(*key->cb.on_read_complete)(key, op_key, bytes_status);
return PJ_SUCCESS;
}
op_rec = op_rec->next;
}
/* Find the operation in the pending write list. */
op_rec = (struct generic_operation*)key->write_list.next;
while (op_rec != (void*)&key->write_list) {
if (op_rec == (void*)op_key) {
pj_list_erase(op_rec);
op_rec->op = PJ_IOQUEUE_OP_NONE;
pj_mutex_unlock(key->mutex);
(*key->cb.on_write_complete)(key, op_key, bytes_status);
return PJ_SUCCESS;
}
op_rec = op_rec->next;
}
/* Find the operation in the pending accept list. */
op_rec = (struct generic_operation*)key->accept_list.next;
while (op_rec != (void*)&key->accept_list) {
if (op_rec == (void*)op_key) {
pj_list_erase(op_rec);
op_rec->op = PJ_IOQUEUE_OP_NONE;
pj_mutex_unlock(key->mutex);
(*key->cb.on_accept_complete)(key, op_key,
PJ_INVALID_SOCKET,
bytes_status);
return PJ_SUCCESS;
}
op_rec = op_rec->next;
}
pj_mutex_unlock(key->mutex);
return PJ_EINVALIDOP;
}
示例4: PJ_DEF
PJ_DEF(void) pj_caching_pool_destroy( pj_caching_pool *cp )
{
int i;
pj_pool_t *pool;
PJ_CHECK_STACK();
/* Delete all pool in free list */
for (i=0; i < PJ_CACHING_POOL_ARRAY_SIZE; ++i) {
pj_pool_t *pool = (pj_pool_t*) cp->free_list[i].next;
pj_pool_t *next;
for (; pool != (void*)&cp->free_list[i]; pool = next) {
next = pool->next;
pj_list_erase(pool);
pj_pool_destroy_int(pool);
}
}
/* Delete all pools in used list */
pool = (pj_pool_t*) cp->used_list.next;
while (pool != (pj_pool_t*) &cp->used_list) {
pj_pool_t *next = pool->next;
pj_list_erase(pool);
PJ_LOG(4,(pool->obj_name,
"Pool is not released by application, releasing now"));
pj_pool_destroy_int(pool);
pool = next;
}
if (cp->lock) {
pj_lock_destroy(cp->lock);
pj_lock_create_null_mutex(NULL, "cachingpool", &cp->lock);
}
}
示例5: pjsip_param_find
/// Mangelwurzel can be configured to generate originating or terminating
/// requests, and out of the blue requests. This requires manipulation of the
/// S-CSCF Route header, which will be the top Route header. Mangelwurzel
/// adds the orig parameter for originating requests, removes it for
/// terminating requests and removes the ODI token from the URI for out of
/// the blue requests.
void MangelwurzelTsx::edit_scscf_route_hdr(pjsip_msg* req, pj_pool_t* pool)
{
pjsip_route_hdr* route_hdr =
(pjsip_route_hdr*)pjsip_msg_find_hdr(req, PJSIP_H_ROUTE, NULL);
if (route_hdr != NULL)
{
pjsip_sip_uri* scscf_uri = (pjsip_sip_uri*)route_hdr->name_addr.uri;
pjsip_param* orig_param = pjsip_param_find(&scscf_uri->other_param,
&STR_ORIG);
if ((_config.orig) && (orig_param == NULL))
{
TRC_DEBUG("Add orig param to S-CSCF Route header");
orig_param = PJ_POOL_ALLOC_T(pool, pjsip_param);
pj_strdup(pool, &orig_param->name, &STR_ORIG);
orig_param->value.slen = 0;
pj_list_insert_after(&scscf_uri->other_param, orig_param);
}
else if ((!_config.orig) && (orig_param != NULL))
{
TRC_DEBUG("Remove orig param from S-CSCF Route header");
pj_list_erase(orig_param);
}
// Ensure there is no ODI token by clearing the user part of the URI.
if (_config.ootb)
{
TRC_DEBUG("Remove ODI token from S-CSCF Route header");
scscf_uri->user.ptr = NULL;
scscf_uri->user.slen = 0;
}
}
}
示例6: pres_evsub_on_srv_state
/* Callback called when *server* subscription state has changed. */
static void pres_evsub_on_srv_state( pjsip_evsub *sub, pjsip_event *event)
{
pjsua_srv_pres *uapres;
PJ_UNUSED_ARG(event);
PJSUA_LOCK();
uapres = (pjsua_srv_pres*) pjsip_evsub_get_mod_data(sub, pjsua_var.mod.id);
if (uapres) {
pjsip_evsub_state state;
PJ_LOG(4,(THIS_FILE, "Server subscription to %s is %s",
uapres->remote, pjsip_evsub_get_state_name(sub)));
state = pjsip_evsub_get_state(sub);
if (pjsua_var.ua_cfg.cb.on_srv_subscribe_state) {
pj_str_t from;
from = uapres->dlg->remote.info_str;
(*pjsua_var.ua_cfg.cb.on_srv_subscribe_state)(uapres->acc_id,
uapres, &from,
state, event);
}
if (state == PJSIP_EVSUB_STATE_TERMINATED) {
pjsip_evsub_set_mod_data(sub, pjsua_var.mod.id, NULL);
pj_list_erase(uapres);
}
}
PJSUA_UNLOCK();
}
示例7: reset_pool
/*
* Reset the pool to the state when it was created.
* All blocks will be deallocated except the first block. All memory areas
* are marked as free.
*/
static void reset_pool(pj_pool_t *pool)
{
pj_pool_block *block;
PJ_CHECK_STACK();
block = pool->block_list.prev;
if (block == &pool->block_list)
return;
/* Skip the first block because it is occupying the same memory
as the pool itself.
*/
block = block->prev;
while (block != &pool->block_list) {
pj_pool_block *prev = block->prev;
pj_list_erase(block);
(*pool->factory->policy.block_free)(pool->factory, block,
block->end - (unsigned char*)block);
block = prev;
}
block = pool->block_list.next;
/* Set the start pointer, aligning it as needed */
block->cur = ALIGN_PTR(block->buf, PJ_POOL_ALIGNMENT);
pool->capacity = block->end - (unsigned char*)pool;
}
示例8: PJ_DEF
/*
* Unregister a codec factory.
*/
PJ_DEF(pj_status_t) pjmedia_codec_mgr_unregister_factory(
pjmedia_codec_mgr *mgr,
pjmedia_codec_factory *factory)
{
unsigned i;
PJ_ASSERT_RETURN(mgr && factory, PJ_EINVAL);
/* Factory must be registered. */
PJ_ASSERT_RETURN(pj_list_find_node(&mgr->factory_list, factory)==factory,
PJ_ENOTFOUND);
/* Erase factory from the factory list */
pj_list_erase(factory);
/* Remove all supported codecs from the codec manager that were created
* by the specified factory.
*/
for (i=0; i<mgr->codec_cnt; ) {
if (mgr->codec_desc[i].factory == factory) {
pj_array_erase(mgr->codec_desc, sizeof(mgr->codec_desc[0]),
mgr->codec_cnt, i);
--mgr->codec_cnt;
} else {
++i;
}
}
return PJ_SUCCESS;
}
示例9: tls_flush_pending_tx
/* Flush all delayed transmision once the socket is connected. */
static void tls_flush_pending_tx(struct tls_transport *tls)
{
pj_lock_acquire(tls->base.lock);
while (!pj_list_empty(&tls->delayed_list)) {
struct delayed_tdata *pending_tx;
pjsip_tx_data *tdata;
pj_ioqueue_op_key_t *op_key;
pj_ssize_t size;
pj_status_t status;
pending_tx = tls->delayed_list.next;
pj_list_erase(pending_tx);
tdata = pending_tx->tdata_op_key->tdata;
op_key = (pj_ioqueue_op_key_t*)pending_tx->tdata_op_key;
/* send! */
size = tdata->buf.cur - tdata->buf.start;
status = pj_ssl_sock_send(tls->ssock, op_key, tdata->buf.start,
&size, 0);
if (status != PJ_EPENDING) {
on_data_sent(tls->ssock, op_key, size);
}
}
pj_lock_release(tls->base.lock);
}
示例10: tcp_destroy
/* Destroy TCP transport */
static pj_status_t tcp_destroy(pjsip_transport *transport,
pj_status_t reason)
{
struct tcp_transport *tcp = (struct tcp_transport*)transport;
if (tcp->close_reason == 0)
tcp->close_reason = reason;
if (tcp->is_registered) {
tcp->is_registered = PJ_FALSE;
pjsip_transport_destroy(transport);
/* pjsip_transport_destroy will recursively call this function
* again.
*/
return PJ_SUCCESS;
}
/* Mark transport as closing */
tcp->is_closing = PJ_TRUE;
/* Stop keep-alive timer. */
if (tcp->ka_timer.id) {
pjsip_endpt_cancel_timer(tcp->base.endpt, &tcp->ka_timer);
tcp->ka_timer.id = PJ_FALSE;
}
/* Cancel all delayed transmits */
while (!pj_list_empty(&tcp->delayed_list)) {
struct delayed_tdata *pending_tx;
pj_ioqueue_op_key_t *op_key;
pending_tx = tcp->delayed_list.next;
pj_list_erase(pending_tx);
op_key = (pj_ioqueue_op_key_t*)pending_tx->tdata_op_key;
on_data_sent(tcp->asock, op_key, -reason);
}
if (tcp->asock) {
pj_activesock_close(tcp->asock);
tcp->asock = NULL;
tcp->sock = PJ_INVALID_SOCKET;
} else if (tcp->sock != PJ_INVALID_SOCKET) {
pj_sock_close(tcp->sock);
tcp->sock = PJ_INVALID_SOCKET;
}
if (tcp->grp_lock) {
pj_grp_lock_t *grp_lock = tcp->grp_lock;
tcp->grp_lock = NULL;
pj_grp_lock_dec_ref(grp_lock);
/* Transport may have been deleted at this point */
} else {
tcp_on_destroy(tcp);
}
return PJ_SUCCESS;
}
示例11: scan_closing_keys
/* Scan the closing list, and put pending closing keys to free list.
* Must do this with ioqueue mutex held.
*/
static void scan_closing_keys(pj_ioqueue_t *ioqueue)
{
if (!pj_list_empty(&ioqueue->closing_list)) {
pj_time_val now;
pj_ioqueue_key_t *key;
pj_gettickcount(&now);
/* Move closing keys to free list when they've finished the closing
* idle time.
*/
key = ioqueue->closing_list.next;
while (key != &ioqueue->closing_list) {
pj_ioqueue_key_t *next = key->next;
pj_assert(key->closing != 0);
if (PJ_TIME_VAL_GTE(now, key->free_time)) {
pj_list_erase(key);
pj_list_push_back(&ioqueue->free_list, key);
}
key = next;
}
}
}
示例12: tsx_erase
static pj_status_t tsx_erase(pj_stun_session *sess,
pj_stun_tx_data *tdata)
{
PJ_UNUSED_ARG(sess);
pj_list_erase(tdata);
return PJ_SUCCESS;
}
示例13: main
int main()
{
struct my_node nodes[10];
struct my_node list;
struct my_node *it;
int i;
// Initialize the list as empty.
pj_list_init(&list);
// Insert nodes.
for (i=0; i<10; ++i) {
nodes[i].value = i;
pj_list_insert_before(&list, &nodes[i]);
}
// Iterate list nodes.
it = list.next;
while (it != &list) {
PJ_LOG(3,("list", "value = %d", it->value));
it = it->next;
}
// Erase all nodes.
for (i=0; i<10; ++i) {
pj_list_erase(&nodes[i]);
}
// List must be empty by now.
pj_assert( pj_list_empty(&list) );
return 0;
};
示例14: destroy_tdata
static void destroy_tdata(pj_stun_tx_data *tdata, pj_bool_t force)
{
if (tdata->res_timer.id != PJ_FALSE) {
pj_timer_heap_cancel(tdata->sess->cfg->timer_heap,
&tdata->res_timer);
tdata->res_timer.id = PJ_FALSE;
pj_list_erase(tdata);
}
if (force) {
if (tdata->client_tsx) {
tsx_erase(tdata->sess, tdata);
pj_stun_client_tsx_destroy(tdata->client_tsx);
}
pj_pool_release(tdata->pool);
} else {
if (tdata->client_tsx) {
pj_time_val delay = {2, 0};
pj_stun_client_tsx_schedule_destroy(tdata->client_tsx, &delay);
} else {
pj_pool_release(tdata->pool);
}
}
}
示例15: PJ_DEF
/*
* Let the Echo Canceller knows that a frame has been captured from
* the microphone.
*/
PJ_DEF(pj_status_t) pjmedia_echo_capture( pjmedia_echo_state *echo,
pj_int16_t *rec_frm,
unsigned options )
{
struct frame *oldest_frm;
pj_status_t status, rc;
if (!echo->lat_ready) {
/* Prefetching to fill in the desired latency */
PJ_LOG(5,(echo->obj_name, "Prefetching.."));
return PJ_SUCCESS;
}
/* Retrieve oldest frame from the latency buffer */
oldest_frm = echo->lat_buf.next;
pj_list_erase(oldest_frm);
/* Cancel echo using this reference frame */
status = pjmedia_echo_cancel(echo, rec_frm, oldest_frm->buf,
options, NULL);
/* Move one frame from delay buffer to the latency buffer. */
rc = pjmedia_delay_buf_get(echo->delay_buf, oldest_frm->buf);
if (rc != PJ_SUCCESS) {
/* Ooops.. no frame! */
PJ_LOG(5,(echo->obj_name,
"No frame from delay buffer. This will upset EC later"));
pjmedia_zero_samples(oldest_frm->buf, echo->samples_per_frame);
}
pj_list_push_back(&echo->lat_buf, oldest_frm);
return status;
}