container& connection::container() const { class container* c = connection_context::get(pn_object()).container; if (!c) { pn_reactor_t *r = pn_object_reactor(pn_object()); if (r) c = &container_context::get(r); } if (!c) throw proton::error("connection does not have a container"); return *c; }
void receiver::drain() { link_context &ctx = link_context::get(pn_object()); if (ctx.draining) throw proton::error("drain already in progress"); else { ctx.draining = true; if (credit() > 0) pn_link_set_drain(pn_object(), true); else { // Drain is already complete. No state to communicate over the wire. // Create dummy flow event where "drain finish" can be detected. pn_connection_t *pnc = pn_session_connection(pn_link_session(pn_object())); connection_context& cctx = connection_context::get(pnc); // connection_engine collector is per connection. Reactor collector is global. pn_collector_t *coll = cctx.collector; if (!coll) coll = pn_reactor_collector(pn_object_reactor(pnc)); pn_collector_put(coll, PN_OBJECT, pn_object(), PN_LINK_FLOW); } } }
container& connection::container() { return container_context(pn_object_reactor(pn_cast(this))); }
container& connection::container() const { pn_reactor_t *r = pn_object_reactor(pn_object()); if (!r) throw proton::error("connection does not have a container"); return container_context::get(r); }