static void setup_outgoing_link(qd_container_t *container, pn_link_t *pn_link) { sys_mutex_lock(container->lock); qd_node_t *node = 0; const char *source = pn_terminus_get_address(pn_link_remote_source(pn_link)); qd_field_iterator_t *iter; // TODO - Extract the name from the structured source if (source) { iter = qd_address_iterator_string(source, ITER_VIEW_NODE_ID); qd_hash_retrieve(container->node_map, iter, (void*) &node); qd_field_iterator_free(iter); } sys_mutex_unlock(container->lock); if (node == 0) { if (container->default_node) node = container->default_node; else { pn_condition_t *cond = pn_link_condition(pn_link); pn_condition_set_name(cond, "amqp:not-found"); pn_condition_set_description(cond, "Source node does not exist"); pn_link_close(pn_link); return; } } qd_link_t *link = new_qd_link_t(); if (!link) { pn_condition_t *cond = pn_link_condition(pn_link); pn_condition_set_name(cond, "amqp:internal-error"); pn_condition_set_description(cond, "Insufficient memory"); pn_link_close(pn_link); return; } link->pn_sess = pn_link_session(pn_link); link->pn_link = pn_link; link->direction = QD_OUTGOING; link->context = 0; link->node = node; link->remote_snd_settle_mode = pn_link_remote_snd_settle_mode(pn_link); link->drain_mode = pn_link_get_drain(pn_link); link->close_sess_with_link = false; // // Keep the borrowed references // pn_incref(pn_link); pn_incref(link->pn_sess); pn_link_set_context(pn_link, link); node->ntype->outgoing_handler(node->context, link); }
void _qd_policy_deny_amqp_link(pn_link_t *link, qd_connection_t *qd_conn) { pn_condition_t * cond = pn_link_condition(link); (void) pn_condition_set_name( cond, RESOURCE_LIMIT_EXCEEDED); (void) pn_condition_set_description(cond, LINK_DISALLOWED); pn_link_close(link); }
static void CORE_link_detach(void *context, qdr_link_t *link, qdr_error_t *error, bool first, bool close) { qd_link_t *qlink = (qd_link_t*) qdr_link_get_context(link); if (!qlink) return; pn_link_t *pn_link = qd_link_pn(qlink); if (!pn_link) return; if (error) { pn_condition_t *cond = pn_link_condition(pn_link); qdr_error_copy(error, cond); } if (close) qd_link_close(qlink); else qd_link_detach(qlink); // // This is the last event for this link that we are going to send into Proton. // Remove the core->proton linkage. Note that the proton->core linkage may still // be intact and needed. // qdr_link_set_context(link, 0); // // If this is the second detach, free the qd_link // if (!first) qd_link_free(qlink); }
void link::close(const error_condition& condition) { set_error_condition(condition, pn_link_condition(pn_object())); close(); }
condition link::local_condition() const { return condition(pn_link_condition(pn_object())); }