Ejemplo n.º 1
0
static void pni_emit(pn_transport_t *transport)
{
  if (transport->connection && transport->connection->collector) {
    pn_collector_t *collector = transport->connection->collector;
    pn_collector_put(collector, PN_OBJECT, transport, PN_TRANSPORT);
  }
}
Ejemplo n.º 2
0
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);
        }
    }
}