// AMQP // ==== #include "amqp_common.h" Term amqp_qos_run(Env e, Term* f, IoWork* w) { LapineChannel* chan = (LapineChannel*)(intptr_t)f[0]; if (chan == NULL || chan->conn == NULL) { return io_fail(e, EINVAL, "lapine: invalid channel"); } u32 prefetch = (u32)f[1]; amqp_rpc_reply_t reply = amqp_basic_qos( chan->conn, chan->channel, 0, (uint16_t)prefetch, 0); u32 err = lapine_rpc_error(reply); if (err != 0) { return io_fail(e, err, "lapine: qos failed"); } return io_tup(e, f[0], io_done(e, term_pak(CID_UNIT, 0))); } static void __attribute__((constructor)) amqp_qos_use(void) { io_eff(CID_AMQP_QOS, amqp_qos_run, 0); }