void
dnode_req_peer_dequeue_imsgq(struct context *ctx, struct conn *conn, struct msg *msg)
{
	ASSERT(msg->request);
	ASSERT(!conn->dnode_client && !conn->dnode_server);

	TAILQ_REMOVE(&conn->imsg_q, msg, s_tqe);

	/* stats_server_decr(ctx, conn->owner, in_queue); */
	/* stats_server_decr_by(ctx, conn->owner, in_queue_bytes, msg->mlen); */
	struct server_pool *pool = (struct server_pool *) array_get(&ctx->pool, 0);
    stats_pool_decr(ctx, pool, peer_in_queue);
    stats_pool_decr_by(ctx, pool, peer_in_queue_bytes, msg->mlen);
}
void
dnode_req_client_dequeue_omsgq(struct context *ctx, struct conn *conn, struct msg *msg)
{
    ASSERT(msg->request);
    ASSERT(conn->type == CONN_DNODE_PEER_CLIENT);

    TAILQ_REMOVE(&conn->omsg_q, msg, c_tqe);
    log_debug(LOG_VERB, "conn %p dequeue outq %p", conn, msg);

    //use the 1st pool
    struct server_pool *pool = (struct server_pool *) array_get(&ctx->pool, 0);
    stats_pool_decr(ctx, pool, dnode_client_out_queue);
    stats_pool_decr_by(ctx, pool, dnode_client_out_queue_bytes, msg->mlen);
}
static void
dnode_req_client_dequeue_omsgq(struct context *ctx, struct conn *conn, struct msg *msg)
{
    ASSERT(msg->request);
    ASSERT(conn->type == CONN_DNODE_PEER_CLIENT);

    TAILQ_REMOVE(&conn->omsg_q, msg, c_tqe);
    log_debug(LOG_VERB, "conn %p dequeue outq %p", conn, msg);

    //use the 1st pool
    conn->omsg_count--;
    histo_add(&ctx->stats->dnode_client_out_queue, conn->omsg_count);
    stats_pool_decr(ctx, dnode_client_out_queue);
    stats_pool_decr_by(ctx, dnode_client_out_queue_bytes, msg->mlen);
}
void
dnode_req_peer_dequeue_imsgq(struct context *ctx, struct conn *conn, struct msg *msg)
{
    ASSERT(msg->request);
    ASSERT(conn->type == CONN_DNODE_PEER_SERVER);

    TAILQ_REMOVE(&conn->imsg_q, msg, s_tqe);
    log_debug(LOG_VERB, "conn %p dequeue inq %d:%d", conn, msg->id, msg->parent_id);

    struct server_pool *pool = (struct server_pool *) array_get(&ctx->pool, 0);
    if (conn->same_dc)
        stats_pool_decr(ctx, pool, peer_in_queue);
    else
        stats_pool_decr(ctx, pool, remote_peer_in_queue);
    stats_pool_decr_by(ctx, pool, peer_in_queue_bytes, msg->mlen);
}