lib/libdmsg/msg_lnk.c
static
h2span_relay_t *
dmsg_generate_relay(h2span_conn_t *conn, h2span_link_t *slink)
{
	h2span_relay_t *relay;
	dmsg_msg_t *msg;

	relay = dmsg_alloc(sizeof(*relay));
	relay->conn = conn;
	relay->source_rt = slink->state;
	/* relay->source_rt->any.link = slink; */

	/*
	 * NOTE: relay->target_rt->any.relay set to relay by alloc.
	 */
	msg = dmsg_msg_alloc(&conn->state->iocom->circuit0,
			     0, DMSG_LNK_SPAN | DMSGF_CREATE,
			     dmsg_lnk_relay, relay);
	relay->target_rt = msg->state;

	msg->any.lnk_span = slink->state->msg->any.lnk_span;
	msg->any.lnk_span.dist = slink->dist + 1;
	msg->any.lnk_span.rnss = slink->rnss + dmsg_rnss();

	RB_INSERT(h2span_relay_tree, &conn->tree, relay);
	TAILQ_INSERT_TAIL(&slink->relayq, relay, entry);

	dmsg_msg_write(msg);

	return (relay);
}
/*
 * Helper function to generate missing relay.
 *
 * cluster_mtx must be held
 */
Helper function to generate missing relay.
cluster_mtx must be held
Helper function to generate missing relay . cluster_mtx must be held
static
h2span_relay_t *
dmsg_generate_relay(h2span_conn_t *conn, h2span_link_t *slink)
{
	h2span_relay_t *relay;
	dmsg_msg_t *msg;
	relay = dmsg_alloc(sizeof(*relay));
	relay->conn = conn;
	relay->source_rt = slink->state;
	msg = dmsg_msg_alloc(&conn->state->iocom->circuit0,
			     0, DMSG_LNK_SPAN | DMSGF_CREATE,
			     dmsg_lnk_relay, relay);
	relay->target_rt = msg->state;
	msg->any.lnk_span = slink->state->msg->any.lnk_span;
	msg->any.lnk_span.dist = slink->dist + 1;
	msg->any.lnk_span.rnss = slink->rnss + dmsg_rnss();
	RB_INSERT(h2span_relay_tree, &conn->tree, relay);
	TAILQ_INSERT_TAIL(&slink->relayq, relay, entry);
	dmsg_msg_write(msg);
	return (relay);
}
static h2span_relay_t * dmsg_generate_relay ( h2span_conn_t * conn , h2span_link_t * slink ) { h2span_relay_t * relay ; dmsg_msg_t * msg ; relay = dmsg_alloc ( sizeof ( * relay ) ) ; relay -> conn = conn ; relay -> source_rt = slink -> state ; msg = dmsg_msg_alloc ( & conn -> state -> iocom -> circuit0 , 0 , DMSG_LNK_SPAN | DMSGF_CREATE , dmsg_lnk_relay , relay ) ; relay -> target_rt = msg -> state ; msg -> any . lnk_span = slink -> state -> msg -> any . lnk_span ; msg -> any . lnk_span . dist = slink -> dist + 1 ; msg -> any . lnk_span . rnss = slink -> rnss + dmsg_rnss ( ) ; RB_INSERT ( h2span_relay_tree , & conn -> tree , relay ) ; TAILQ_INSERT_TAIL ( & slink -> relayq , relay , entry ) ; dmsg_msg_write ( msg ) ; return ( relay ) ; }
Helper function to generate missing relay.
Helper function to generate missing relay .
/* relay->source_rt->any.link = slink; */ /*
	 * NOTE: relay->target_rt->any.relay set to relay by alloc.
	 */