bmap_init(&c->export_map, p, 16);
bmap_init(&c->export_reject_map, p, 16);
+ bmap_init(&c->refeed_map, p, 16);
channel_reset_limit(c, &c->out_limit, PLD_OUT);
bmap_reset(&c->export_map, 16);
bmap_reset(&c->export_reject_map, 16);
+ bmap_reset(&c->refeed_map, 16);
rt_request_export(c->table, req);
return;
/* No direct feeding, running auxiliary refeed. */
c->refeeding = c->refeed_pending;
c->refeed_pending = NULL;
- c->refeed_trie = f_new_trie(lp_new(c->proto->pool), 0);
+ bmap_reset(&c->refeed_map, 16);
if (no_trie)
{
/* Drop the refeed batch */
c->refeeding = NULL;
- if (c->refeed_trie)
- {
- rfree(c->refeed_trie->lp);
- c->refeed_trie = NULL;
- }
/* Run the pending batch */
if (c->refeed_pending)
struct rt_export_request out_req; /* Table export connection */
struct rt_export_request refeed_req; /* Auxiliary refeed request */
- struct f_trie *refeed_trie; /* Auxiliary refeed trie */
+ struct bmap refeed_map; /* Auxiliary refeed netindex bitmap */
struct channel_feeding_request *refeeding; /* Refeeding the channel */
struct channel_feeding_request *refeed_pending; /* Scheduled refeeds */
struct channel_import_request *importing; /* Importing the channel */
static inline int channel_net_is_refeeding(struct channel *c, const net_addr *n)
{
/* Not refeeding if not refeeding at all */
- if (!c->refeeding || !c->refeed_trie)
+ if (!c->refeeding)
return 0;
/* Not refeeding if already refed */
- if (trie_match_net(c->refeed_trie, n))
+ struct netindex *ni = NET_TO_INDEX(n);
+ if (bmap_test(&c->refeed_map, ni->index))
return 0;
/* Refeeding if matching any request */
}
static inline void channel_net_mark_refed(struct channel *c, const net_addr *n)
{
- ASSERT_DIE(c->refeeding && c->refeed_trie);
- trie_add_prefix(c->refeed_trie, n, n->pxlen, n->pxlen);
+ ASSERT_DIE(c->refeeding);
+
+ struct netindex *ni = NET_TO_INDEX(n);
+ bmap_set(&c->refeed_map, ni->index);
}
void channel_request_reload(struct channel *c);