move util library into ddsrt
As was the plan with the introduction of ddsrt; this includes renaming the identifiers to match the capitalization style and removes old junk. Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
e965df5db7
commit
6c171a890d
62 changed files with 1702 additions and 1869 deletions
|
@ -15,7 +15,7 @@
|
|||
#include "dds/ddsrt/endian.h"
|
||||
#include "dds/ddsi/q_plist.h" /* for nn_prismtech_writer_info */
|
||||
#include "dds/ddsi/q_freelist.h"
|
||||
#include "dds/util/ut_avl.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
#include "dds/ddsi/ddsi_serdata.h"
|
||||
#include "dds/ddsi/ddsi_sertopic.h"
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#define DDSI_SERTOPIC_H
|
||||
|
||||
#include "dds/ddsrt/atomics.h"
|
||||
#include "dds/util/ut_avl.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
#include "dds/ddsc/dds_public_alloc.h"
|
||||
|
||||
struct ddsi_serdata;
|
||||
|
@ -25,7 +25,7 @@ typedef void (*topic_cb_t) (struct dds_topic * topic);
|
|||
struct ddsi_sertopic_ops;
|
||||
|
||||
struct ddsi_sertopic {
|
||||
ut_avlNode_t avlnode; /* index on name_typename */
|
||||
ddsrt_avl_node_t avlnode; /* index on name_typename */
|
||||
const struct ddsi_sertopic_ops *ops;
|
||||
const struct ddsi_serdata_ops *serdata_ops;
|
||||
uint32_t serdata_basehash;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#define NN_ADDRSET_H
|
||||
|
||||
#include "dds/ddsrt/sync.h"
|
||||
#include "dds/util/ut_avl.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
#include "dds/ddsi/q_log.h"
|
||||
#include "dds/ddsi/q_protocol.h"
|
||||
#include "dds/ddsi/q_feature_check.h"
|
||||
|
@ -23,14 +23,14 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
typedef struct addrset_node {
|
||||
ut_avlNode_t avlnode;
|
||||
ddsrt_avl_node_t avlnode;
|
||||
nn_locator_t loc;
|
||||
} * addrset_node_t;
|
||||
|
||||
struct addrset {
|
||||
ddsrt_mutex_t lock;
|
||||
ddsrt_atomic_uint32_t refc;
|
||||
ut_avlCTree_t ucaddrs, mcaddrs;
|
||||
ddsrt_avl_ctree_t ucaddrs, mcaddrs;
|
||||
};
|
||||
|
||||
typedef void (*addrset_forall_fun_t) (const nn_locator_t *loc, void *arg);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#define Q_ENTITY_H
|
||||
|
||||
#include "dds/ddsrt/atomics.h"
|
||||
#include "dds/util/ut_avl.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
#include "dds/ddsi/q_rtps.h"
|
||||
#include "dds/ddsi/q_protocol.h"
|
||||
#include "dds/ddsi/q_lat_estim.h"
|
||||
|
@ -54,12 +54,12 @@ status_cb_data_t;
|
|||
typedef void (*status_cb_t) (void *entity, const status_cb_data_t *data);
|
||||
|
||||
struct prd_wr_match {
|
||||
ut_avlNode_t avlnode;
|
||||
ddsrt_avl_node_t avlnode;
|
||||
nn_guid_t wr_guid;
|
||||
};
|
||||
|
||||
struct rd_pwr_match {
|
||||
ut_avlNode_t avlnode;
|
||||
ddsrt_avl_node_t avlnode;
|
||||
nn_guid_t pwr_guid;
|
||||
#ifdef DDSI_INCLUDE_SSM
|
||||
nn_locator_t ssm_mc_loc;
|
||||
|
@ -68,17 +68,17 @@ struct rd_pwr_match {
|
|||
};
|
||||
|
||||
struct wr_rd_match {
|
||||
ut_avlNode_t avlnode;
|
||||
ddsrt_avl_node_t avlnode;
|
||||
nn_guid_t rd_guid;
|
||||
};
|
||||
|
||||
struct rd_wr_match {
|
||||
ut_avlNode_t avlnode;
|
||||
ddsrt_avl_node_t avlnode;
|
||||
nn_guid_t wr_guid;
|
||||
};
|
||||
|
||||
struct wr_prd_match {
|
||||
ut_avlNode_t avlnode;
|
||||
ddsrt_avl_node_t avlnode;
|
||||
nn_guid_t prd_guid; /* guid of the proxy reader */
|
||||
unsigned assumed_in_sync: 1; /* set to 1 upon receipt of ack not nack'ing msgs */
|
||||
unsigned has_replied_to_hb: 1; /* we must keep sending HBs until all readers have this set */
|
||||
|
@ -105,7 +105,7 @@ enum pwr_rd_match_syncstate {
|
|||
};
|
||||
|
||||
struct pwr_rd_match {
|
||||
ut_avlNode_t avlnode;
|
||||
ddsrt_avl_node_t avlnode;
|
||||
nn_guid_t rd_guid;
|
||||
nn_mtime_t tcreate;
|
||||
nn_count_t count; /* most recent acknack sequence number */
|
||||
|
@ -247,8 +247,8 @@ struct writer
|
|||
nn_etime_t t_rexmit_end; /* time of last 1->0 transition of "retransmitting" */
|
||||
nn_etime_t t_whc_high_upd; /* time "whc_high" was last updated for controlled ramp-up of throughput */
|
||||
int num_reliable_readers; /* number of matching reliable PROXY readers */
|
||||
ut_avlTree_t readers; /* all matching PROXY readers, see struct wr_prd_match */
|
||||
ut_avlTree_t local_readers; /* all matching LOCAL readers, see struct wr_rd_match */
|
||||
ddsrt_avl_tree_t readers; /* all matching PROXY readers, see struct wr_prd_match */
|
||||
ddsrt_avl_tree_t local_readers; /* all matching LOCAL readers, see struct wr_rd_match */
|
||||
#ifdef DDSI_INCLUDE_NETWORK_PARTITIONS
|
||||
uint32_t partition_id;
|
||||
#endif
|
||||
|
@ -280,8 +280,8 @@ struct reader
|
|||
struct addrset *as;
|
||||
#endif
|
||||
const struct ddsi_sertopic * topic; /* topic is NULL for built-in readers */
|
||||
ut_avlTree_t writers; /* all matching PROXY writers, see struct rd_pwr_match */
|
||||
ut_avlTree_t local_writers; /* all matching LOCAL writers, see struct rd_wr_match */
|
||||
ddsrt_avl_tree_t writers; /* all matching PROXY writers, see struct rd_pwr_match */
|
||||
ddsrt_avl_tree_t local_writers; /* all matching LOCAL writers, see struct rd_wr_match */
|
||||
ddsi2direct_directread_cb_t ddsi2direct_cb;
|
||||
void *ddsi2direct_cbarg;
|
||||
};
|
||||
|
@ -299,7 +299,7 @@ struct proxy_participant
|
|||
struct addrset *as_default; /* default address set to use for user data traffic */
|
||||
struct addrset *as_meta; /* default address set to use for discovery traffic */
|
||||
struct proxy_endpoint_common *endpoints; /* all proxy endpoints can be reached from here */
|
||||
ut_avlTree_t groups; /* table of all groups (publisher, subscriber), see struct proxy_group */
|
||||
ddsrt_avl_tree_t groups; /* table of all groups (publisher, subscriber), see struct proxy_group */
|
||||
unsigned kernel_sequence_numbers : 1; /* whether this proxy participant generates OSPL kernel sequence numbers */
|
||||
unsigned implicitly_created : 1; /* participants are implicitly created for Cloud/Fog discovered endpoints */
|
||||
unsigned is_ddsi2_pp: 1; /* if this is the federation-leader on the remote node */
|
||||
|
@ -318,7 +318,7 @@ struct proxy_participant
|
|||
tables, but "groups" only live in the context of a proxy
|
||||
participant. */
|
||||
struct proxy_group {
|
||||
ut_avlNode_t avlnode;
|
||||
ddsrt_avl_node_t avlnode;
|
||||
nn_guid_t guid;
|
||||
char *name;
|
||||
struct proxy_participant *proxypp; /* uncounted backref to proxy participant */
|
||||
|
@ -340,7 +340,7 @@ struct proxy_endpoint_common
|
|||
struct proxy_writer {
|
||||
struct entity_common e;
|
||||
struct proxy_endpoint_common c;
|
||||
ut_avlTree_t readers; /* matching LOCAL readers, see pwr_rd_match */
|
||||
ddsrt_avl_tree_t readers; /* matching LOCAL readers, see pwr_rd_match */
|
||||
int n_reliable_readers; /* number of those that are reliable */
|
||||
int n_readers_out_of_sync; /* number of those that require special handling (accepting historical data, waiting for historical data set to become complete) */
|
||||
seqno_t last_seq; /* highest known seq published by the writer, not last delivered */
|
||||
|
@ -373,16 +373,16 @@ struct proxy_reader {
|
|||
#ifdef DDSI_INCLUDE_SSM
|
||||
unsigned favours_ssm: 1; /* iff 1, this proxy reader favours SSM when available */
|
||||
#endif
|
||||
ut_avlTree_t writers; /* matching LOCAL writers */
|
||||
ddsrt_avl_tree_t writers; /* matching LOCAL writers */
|
||||
};
|
||||
|
||||
extern const ut_avlTreedef_t wr_readers_treedef;
|
||||
extern const ut_avlTreedef_t wr_local_readers_treedef;
|
||||
extern const ut_avlTreedef_t rd_writers_treedef;
|
||||
extern const ut_avlTreedef_t rd_local_writers_treedef;
|
||||
extern const ut_avlTreedef_t pwr_readers_treedef;
|
||||
extern const ut_avlTreedef_t prd_writers_treedef;
|
||||
extern const ut_avlTreedef_t deleted_participants_treedef;
|
||||
extern const ddsrt_avl_treedef_t wr_readers_treedef;
|
||||
extern const ddsrt_avl_treedef_t wr_local_readers_treedef;
|
||||
extern const ddsrt_avl_treedef_t rd_writers_treedef;
|
||||
extern const ddsrt_avl_treedef_t rd_local_writers_treedef;
|
||||
extern const ddsrt_avl_treedef_t pwr_readers_treedef;
|
||||
extern const ddsrt_avl_treedef_t prd_writers_treedef;
|
||||
extern const ddsrt_avl_treedef_t deleted_participants_treedef;
|
||||
|
||||
#define DPG_LOCAL 1
|
||||
#define DPG_REMOTE 2
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#ifndef Q_EPHASH_H
|
||||
#define Q_EPHASH_H
|
||||
|
||||
#include "dds/util/ut_hopscotch.h"
|
||||
#include "dds/ddsrt/hopscotch.h"
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
|
@ -39,7 +39,7 @@ struct nn_guid;
|
|||
|
||||
struct ephash_enum
|
||||
{
|
||||
struct ut_chhIter it;
|
||||
struct ddsrt_chh_iter it;
|
||||
enum entity_kind kind;
|
||||
struct entity_common *cur;
|
||||
};
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "dds/ddsrt/atomics.h"
|
||||
#include "dds/ddsrt/sockets.h"
|
||||
#include "dds/ddsrt/sync.h"
|
||||
#include "dds/util/ut_fibheap.h"
|
||||
#include "dds/ddsrt/fibheap.h"
|
||||
|
||||
#include "dds/ddsi/q_plist.h"
|
||||
#include "dds/ddsi/q_protocol.h"
|
||||
|
@ -47,7 +47,7 @@ struct lease;
|
|||
struct ddsi_tran_conn;
|
||||
struct ddsi_tran_listener;
|
||||
struct ddsi_tran_factory;
|
||||
struct ut_thread_pool_s;
|
||||
struct ddsrt_thread_pool_s;
|
||||
struct debug_monitor;
|
||||
struct ddsi_tkmap;
|
||||
|
||||
|
@ -110,7 +110,7 @@ struct q_globals {
|
|||
/* Lease junk */
|
||||
ddsrt_mutex_t leaseheap_lock;
|
||||
ddsrt_mutex_t lease_locks[N_LEASE_LOCKS];
|
||||
ut_fibheap_t leaseheap;
|
||||
ddsrt_fibheap_t leaseheap;
|
||||
|
||||
/* Transport factory */
|
||||
|
||||
|
@ -133,7 +133,7 @@ struct q_globals {
|
|||
|
||||
/* Thread pool */
|
||||
|
||||
struct ut_thread_pool_s * thread_pool;
|
||||
struct ddsrt_thread_pool_s * thread_pool;
|
||||
|
||||
/* In many sockets mode, the receive threads maintain a local array
|
||||
with participant GUIDs and sockets, participant_set_generation is
|
||||
|
|
|
@ -12,14 +12,14 @@
|
|||
#ifndef NN_INVERSE_UINT32_SET_H
|
||||
#define NN_INVERSE_UINT32_SET_H
|
||||
|
||||
#include "dds/util/ut_avl.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
|
||||
struct inverse_uint32_set_node {
|
||||
ut_avlNode_t avlnode;
|
||||
ddsrt_avl_node_t avlnode;
|
||||
uint32_t min, max;
|
||||
};
|
||||
struct inverse_uint32_set {
|
||||
ut_avlTree_t ids;
|
||||
ddsrt_avl_tree_t ids;
|
||||
uint32_t cursor;
|
||||
uint32_t min, max;
|
||||
};
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
#include "dds/ddsi/ddsi_mcgroup.h"
|
||||
#include "dds/ddsi/q_config.h"
|
||||
#include "dds/ddsi/q_log.h"
|
||||
#include "dds/util/ut_avl.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
|
||||
struct nn_group_membership_node {
|
||||
ut_avlNode_t avlnode;
|
||||
ddsrt_avl_node_t avlnode;
|
||||
ddsi_tran_conn_t conn;
|
||||
nn_locator_t srcloc;
|
||||
nn_locator_t mcloc;
|
||||
|
@ -32,7 +32,7 @@ struct nn_group_membership_node {
|
|||
|
||||
struct nn_group_membership {
|
||||
ddsrt_mutex_t lock;
|
||||
ut_avlTree_t mships;
|
||||
ddsrt_avl_tree_t mships;
|
||||
};
|
||||
|
||||
static int locator_compare_no_port (const nn_locator_t *as, const nn_locator_t *bs)
|
||||
|
@ -60,19 +60,19 @@ static int cmp_group_membership (const void *va, const void *vb)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static ut_avlTreedef_t mship_td = UT_AVL_TREEDEF_INITIALIZER(offsetof (struct nn_group_membership_node, avlnode), 0, cmp_group_membership, 0);
|
||||
static ddsrt_avl_treedef_t mship_td = DDSRT_AVL_TREEDEF_INITIALIZER(offsetof (struct nn_group_membership_node, avlnode), 0, cmp_group_membership, 0);
|
||||
|
||||
struct nn_group_membership *new_group_membership (void)
|
||||
{
|
||||
struct nn_group_membership *mship = ddsrt_malloc (sizeof (*mship));
|
||||
ddsrt_mutex_init (&mship->lock);
|
||||
ut_avlInit (&mship_td, &mship->mships);
|
||||
ddsrt_avl_init (&mship_td, &mship->mships);
|
||||
return mship;
|
||||
}
|
||||
|
||||
void free_group_membership (struct nn_group_membership *mship)
|
||||
{
|
||||
ut_avlFree (&mship_td, &mship->mships, ddsrt_free);
|
||||
ddsrt_avl_free (&mship_td, &mship->mships, ddsrt_free);
|
||||
ddsrt_mutex_destroy (&mship->lock);
|
||||
ddsrt_free (mship);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ void free_group_membership (struct nn_group_membership *mship)
|
|||
static int reg_group_membership (struct nn_group_membership *mship, ddsi_tran_conn_t conn, const nn_locator_t *srcloc, const nn_locator_t *mcloc)
|
||||
{
|
||||
struct nn_group_membership_node key, *n;
|
||||
ut_avlIPath_t ip;
|
||||
ddsrt_avl_ipath_t ip;
|
||||
int isnew;
|
||||
key.conn = conn;
|
||||
if (srcloc)
|
||||
|
@ -88,7 +88,7 @@ static int reg_group_membership (struct nn_group_membership *mship, ddsi_tran_co
|
|||
else
|
||||
memset (&key.srcloc, 0, sizeof (key.srcloc));
|
||||
key.mcloc = *mcloc;
|
||||
if ((n = ut_avlLookupIPath (&mship_td, &mship->mships, &key, &ip)) != NULL) {
|
||||
if ((n = ddsrt_avl_lookup_ipath (&mship_td, &mship->mships, &key, &ip)) != NULL) {
|
||||
isnew = 0;
|
||||
n->count++;
|
||||
} else {
|
||||
|
@ -98,7 +98,7 @@ static int reg_group_membership (struct nn_group_membership *mship, ddsi_tran_co
|
|||
n->srcloc = key.srcloc;
|
||||
n->mcloc = key.mcloc;
|
||||
n->count = 1;
|
||||
ut_avlInsertIPath (&mship_td, &mship->mships, n, &ip);
|
||||
ddsrt_avl_insert_ipath (&mship_td, &mship->mships, n, &ip);
|
||||
}
|
||||
return isnew;
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ static int reg_group_membership (struct nn_group_membership *mship, ddsi_tran_co
|
|||
static int unreg_group_membership (struct nn_group_membership *mship, ddsi_tran_conn_t conn, const nn_locator_t *srcloc, const nn_locator_t *mcloc)
|
||||
{
|
||||
struct nn_group_membership_node key, *n;
|
||||
ut_avlDPath_t dp;
|
||||
ddsrt_avl_dpath_t dp;
|
||||
int mustdel;
|
||||
key.conn = conn;
|
||||
if (srcloc)
|
||||
|
@ -114,7 +114,7 @@ static int unreg_group_membership (struct nn_group_membership *mship, ddsi_tran_
|
|||
else
|
||||
memset (&key.srcloc, 0, sizeof (key.srcloc));
|
||||
key.mcloc = *mcloc;
|
||||
n = ut_avlLookupDPath (&mship_td, &mship->mships, &key, &dp);
|
||||
n = ddsrt_avl_lookup_dpath (&mship_td, &mship->mships, &key, &dp);
|
||||
assert (n != NULL);
|
||||
assert (n->count > 0);
|
||||
if (--n->count > 0)
|
||||
|
@ -122,7 +122,7 @@ static int unreg_group_membership (struct nn_group_membership *mship, ddsi_tran_
|
|||
else
|
||||
{
|
||||
mustdel = 1;
|
||||
ut_avlDeleteDPath (&mship_td, &mship->mships, n, &dp);
|
||||
ddsrt_avl_delete_dpath (&mship_td, &mship->mships, n, &dp);
|
||||
ddsrt_free (n);
|
||||
}
|
||||
return mustdel;
|
||||
|
@ -268,13 +268,13 @@ void ddsi_transfer_group_membership (ddsi_tran_conn_t conn, ddsi_tran_conn_t new
|
|||
are neither 0 nor maximum representable, min and max define the range of key values that relate to
|
||||
oldsock */
|
||||
ddsrt_mutex_lock (&gv.mship->lock);
|
||||
n = ut_avlLookupSuccEq (&mship_td, &gv.mship->mships, &min);
|
||||
n = ddsrt_avl_lookup_succ_eq (&mship_td, &gv.mship->mships, &min);
|
||||
while (n != NULL && cmp_group_membership (n, &max) <= 0)
|
||||
{
|
||||
struct nn_group_membership_node * const nn = ut_avlFindSucc (&mship_td, &gv.mship->mships, n);
|
||||
ut_avlDelete (&mship_td, &gv.mship->mships, n);
|
||||
struct nn_group_membership_node * const nn = ddsrt_avl_find_succ (&mship_td, &gv.mship->mships, n);
|
||||
ddsrt_avl_delete (&mship_td, &gv.mship->mships, n);
|
||||
n->conn = newconn;
|
||||
ut_avlInsert (&mship_td, &gv.mship->mships, n);
|
||||
ddsrt_avl_insert (&mship_td, &gv.mship->mships, n);
|
||||
n = nn;
|
||||
}
|
||||
ddsrt_mutex_unlock (&gv.mship->lock);
|
||||
|
@ -283,13 +283,13 @@ void ddsi_transfer_group_membership (ddsi_tran_conn_t conn, ddsi_tran_conn_t new
|
|||
int ddsi_rejoin_transferred_mcgroups (ddsi_tran_conn_t conn)
|
||||
{
|
||||
struct nn_group_membership_node *n, min, max;
|
||||
ut_avlIter_t it;
|
||||
ddsrt_avl_iter_t it;
|
||||
int ret = 0;
|
||||
memset(&min, 0, sizeof(min));
|
||||
memset(&max, 0xff, sizeof(max));
|
||||
min.conn = max.conn = conn;
|
||||
ddsrt_mutex_lock (&gv.mship->lock);
|
||||
for (n = ut_avlIterSuccEq (&mship_td, &gv.mship->mships, &it, &min); n != NULL && ret >= 0 && cmp_group_membership(n, &max) <= 0; n = ut_avlIterNext (&it))
|
||||
for (n = ddsrt_avl_iter_succ_eq (&mship_td, &gv.mship->mships, &it, &min); n != NULL && ret >= 0 && cmp_group_membership(n, &max) <= 0; n = ddsrt_avl_iter_next (&it))
|
||||
{
|
||||
int have_srcloc = (memcmp(&n->srcloc, &min.srcloc, sizeof(n->srcloc)) != 0);
|
||||
assert (n->conn == conn);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "dds/ddsi/ddsi_tran.h"
|
||||
#include "dds/ddsi/ddsi_tcp.h"
|
||||
#include "dds/ddsi/ddsi_ipaddr.h"
|
||||
#include "dds/util/ut_avl.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
#include "dds/ddsi/q_nwif.h"
|
||||
#include "dds/ddsi/q_config.h"
|
||||
#include "dds/ddsi/q_log.h"
|
||||
|
@ -93,12 +93,12 @@ static int ddsi_tcp_cmp_conn_wrap (const void *a, const void *b)
|
|||
|
||||
typedef struct ddsi_tcp_node
|
||||
{
|
||||
ut_avlNode_t m_avlnode;
|
||||
ddsrt_avl_node_t m_avlnode;
|
||||
ddsi_tcp_conn_t m_conn;
|
||||
}
|
||||
* ddsi_tcp_node_t;
|
||||
|
||||
static const ut_avlTreedef_t ddsi_tcp_treedef = UT_AVL_TREEDEF_INITIALIZER_INDKEY
|
||||
static const ddsrt_avl_treedef_t ddsi_tcp_treedef = DDSRT_AVL_TREEDEF_INITIALIZER_INDKEY
|
||||
(
|
||||
offsetof (struct ddsi_tcp_node, m_avlnode),
|
||||
offsetof (struct ddsi_tcp_node, m_conn),
|
||||
|
@ -107,7 +107,7 @@ static const ut_avlTreedef_t ddsi_tcp_treedef = UT_AVL_TREEDEF_INITIALIZER_INDKE
|
|||
);
|
||||
|
||||
static ddsrt_mutex_t ddsi_tcp_cache_lock_g;
|
||||
static ut_avlTree_t ddsi_tcp_cache_g;
|
||||
static ddsrt_avl_tree_t ddsi_tcp_cache_g;
|
||||
static struct ddsi_tran_factory ddsi_tcp_factory_g;
|
||||
|
||||
static ddsi_tcp_conn_t ddsi_tcp_new_conn (ddsrt_socket_t, bool, struct sockaddr *);
|
||||
|
@ -125,11 +125,11 @@ static char *sockaddr_to_string_with_port (char *dst, size_t sizeof_dst, const s
|
|||
static void ddsi_tcp_cache_dump (void)
|
||||
{
|
||||
char buff[64];
|
||||
ut_avlIter_t iter;
|
||||
ddsrt_avl_iter_t iter;
|
||||
ddsi_tcp_node_t n;
|
||||
unsigned i = 0;
|
||||
|
||||
n = ut_avlIterFirst (&ddsi_tcp_treedef, &ddsi_tcp_cache_g, &iter);
|
||||
n = ddsrt_avl_iter_first (&ddsi_tcp_treedef, &ddsi_tcp_cache_g, &iter);
|
||||
while (n)
|
||||
{
|
||||
os_sockaddrAddressPortToString ((const os_sockaddr *) &n->m_conn->m_peer_addr, buff, sizeof (buff));
|
||||
|
@ -140,7 +140,7 @@ static void ddsi_tcp_cache_dump (void)
|
|||
ddsi_name, i++, n->m_conn->m_base.m_server ? "server" : "client",
|
||||
n->m_conn->m_sock, n->m_conn->m_base.m_base.m_port, buff
|
||||
);
|
||||
n = ut_avlIterNext (&iter);
|
||||
n = ddsrt_avl_iter_next (&iter);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
@ -242,7 +242,7 @@ static void ddsi_tcp_conn_connect (ddsi_tcp_conn_t conn, const ddsrt_msghdr_t *
|
|||
}
|
||||
}
|
||||
|
||||
static void ddsi_tcp_cache_add (ddsi_tcp_conn_t conn, ut_avlIPath_t * path)
|
||||
static void ddsi_tcp_cache_add (ddsi_tcp_conn_t conn, ddsrt_avl_ipath_t * path)
|
||||
{
|
||||
const char * action = "added";
|
||||
ddsi_tcp_node_t node;
|
||||
|
@ -255,11 +255,11 @@ static void ddsi_tcp_cache_add (ddsi_tcp_conn_t conn, ut_avlIPath_t * path)
|
|||
{
|
||||
node = ddsrt_malloc (sizeof (*node));
|
||||
node->m_conn = conn;
|
||||
ut_avlInsertIPath (&ddsi_tcp_treedef, &ddsi_tcp_cache_g, node, path);
|
||||
ddsrt_avl_insert_ipath (&ddsi_tcp_treedef, &ddsi_tcp_cache_g, node, path);
|
||||
}
|
||||
else
|
||||
{
|
||||
node = ut_avlLookup (&ddsi_tcp_treedef, &ddsi_tcp_cache_g, conn);
|
||||
node = ddsrt_avl_lookup (&ddsi_tcp_treedef, &ddsi_tcp_cache_g, conn);
|
||||
if (node)
|
||||
{
|
||||
/* Replace connection in cache */
|
||||
|
@ -272,7 +272,7 @@ static void ddsi_tcp_cache_add (ddsi_tcp_conn_t conn, ut_avlIPath_t * path)
|
|||
{
|
||||
node = ddsrt_malloc (sizeof (*node));
|
||||
node->m_conn = conn;
|
||||
ut_avlInsert (&ddsi_tcp_treedef, &ddsi_tcp_cache_g, node);
|
||||
ddsrt_avl_insert (&ddsi_tcp_treedef, &ddsi_tcp_cache_g, node);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,15 +284,15 @@ static void ddsi_tcp_cache_remove (ddsi_tcp_conn_t conn)
|
|||
{
|
||||
char buff[DDSI_LOCSTRLEN];
|
||||
ddsi_tcp_node_t node;
|
||||
ut_avlDPath_t path;
|
||||
ddsrt_avl_dpath_t path;
|
||||
|
||||
ddsrt_mutex_lock (&ddsi_tcp_cache_lock_g);
|
||||
node = ut_avlLookupDPath (&ddsi_tcp_treedef, &ddsi_tcp_cache_g, conn, &path);
|
||||
node = ddsrt_avl_lookup_dpath (&ddsi_tcp_treedef, &ddsi_tcp_cache_g, conn, &path);
|
||||
if (node)
|
||||
{
|
||||
sockaddr_to_string_with_port(buff, sizeof(buff), (struct sockaddr *)&conn->m_peer_addr);
|
||||
DDS_LOG(DDS_LC_TCP, "%s cache removed socket %"PRIdSOCK" to %s\n", ddsi_name, conn->m_sock, buff);
|
||||
ut_avlDeleteDPath (&ddsi_tcp_treedef, &ddsi_tcp_cache_g, node, &path);
|
||||
ddsrt_avl_delete_dpath (&ddsi_tcp_treedef, &ddsi_tcp_cache_g, node, &path);
|
||||
ddsi_tcp_node_free (node);
|
||||
}
|
||||
ddsrt_mutex_unlock (&ddsi_tcp_cache_lock_g);
|
||||
|
@ -305,7 +305,7 @@ static void ddsi_tcp_cache_remove (ddsi_tcp_conn_t conn)
|
|||
|
||||
static ddsi_tcp_conn_t ddsi_tcp_cache_find (const ddsrt_msghdr_t * msg)
|
||||
{
|
||||
ut_avlIPath_t path;
|
||||
ddsrt_avl_ipath_t path;
|
||||
ddsi_tcp_node_t node;
|
||||
struct ddsi_tcp_conn key;
|
||||
ddsi_tcp_conn_t ret = NULL;
|
||||
|
@ -317,12 +317,12 @@ static ddsi_tcp_conn_t ddsi_tcp_cache_find (const ddsrt_msghdr_t * msg)
|
|||
/* Check cache for existing connection to target */
|
||||
|
||||
ddsrt_mutex_lock (&ddsi_tcp_cache_lock_g);
|
||||
node = ut_avlLookupIPath (&ddsi_tcp_treedef, &ddsi_tcp_cache_g, &key, &path);
|
||||
node = ddsrt_avl_lookup_ipath (&ddsi_tcp_treedef, &ddsi_tcp_cache_g, &key, &path);
|
||||
if (node)
|
||||
{
|
||||
if (node->m_conn->m_base.m_closed)
|
||||
{
|
||||
ut_avlDelete (&ddsi_tcp_treedef, &ddsi_tcp_cache_g, node);
|
||||
ddsrt_avl_delete (&ddsi_tcp_treedef, &ddsi_tcp_cache_g, node);
|
||||
ddsi_tcp_node_free (node);
|
||||
}
|
||||
else
|
||||
|
@ -1010,7 +1010,7 @@ static void ddsi_tcp_release_listener (ddsi_tran_listener_t listener)
|
|||
static void ddsi_tcp_release_factory (void)
|
||||
{
|
||||
if (ddsrt_atomic_dec32_nv (&ddsi_tcp_init_g) == 0) {
|
||||
ut_avlFree (&ddsi_tcp_treedef, &ddsi_tcp_cache_g, ddsi_tcp_node_free);
|
||||
ddsrt_avl_free (&ddsi_tcp_treedef, &ddsi_tcp_cache_g, ddsi_tcp_node_free);
|
||||
ddsrt_mutex_destroy (&ddsi_tcp_cache_lock_g);
|
||||
#ifdef DDSI_INCLUDE_SSL
|
||||
if (ddsi_tcp_ssl_plugin.fini)
|
||||
|
@ -1095,7 +1095,7 @@ int ddsi_tcp_init (void)
|
|||
}
|
||||
#endif
|
||||
|
||||
ut_avlInit (&ddsi_tcp_treedef, &ddsi_tcp_cache_g);
|
||||
ddsrt_avl_init (&ddsi_tcp_treedef, &ddsi_tcp_cache_g);
|
||||
ddsrt_mutex_init (&ddsi_tcp_cache_lock_g);
|
||||
|
||||
DDS_LOG(DDS_LC_CONFIG, "%s initialized\n", ddsi_name);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "dds/ddsi/q_config.h"
|
||||
#include "dds/ddsi/ddsi_iid.h"
|
||||
#include "dds/ddsi/ddsi_tkmap.h"
|
||||
#include "dds/util/ut_hopscotch.h"
|
||||
#include "dds/ddsrt/hopscotch.h"
|
||||
#include "dds__stream.h"
|
||||
#include "dds/ddsi/ddsi_serdata.h"
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
struct ddsi_tkmap
|
||||
{
|
||||
struct ut_chh * m_hh;
|
||||
struct ddsrt_chh * m_hh;
|
||||
ddsrt_mutex_t m_lock;
|
||||
ddsrt_cond_t m_cond;
|
||||
};
|
||||
|
@ -87,7 +87,7 @@ static int dds_tk_equals_void (const void *a, const void *b)
|
|||
struct ddsi_tkmap *ddsi_tkmap_new (void)
|
||||
{
|
||||
struct ddsi_tkmap *tkmap = dds_alloc (sizeof (*tkmap));
|
||||
tkmap->m_hh = ut_chhNew (1, dds_tk_hash_void, dds_tk_equals_void, gc_buckets);
|
||||
tkmap->m_hh = ddsrt_chh_new (1, dds_tk_hash_void, dds_tk_equals_void, gc_buckets);
|
||||
ddsrt_mutex_init (&tkmap->m_lock);
|
||||
ddsrt_cond_init (&tkmap->m_cond);
|
||||
return tkmap;
|
||||
|
@ -102,8 +102,8 @@ static void free_tkmap_instance (void *vtk, UNUSED_ARG(void *f_arg))
|
|||
|
||||
void ddsi_tkmap_free (struct ddsi_tkmap * map)
|
||||
{
|
||||
ut_chhEnumUnsafe (map->m_hh, free_tkmap_instance, NULL);
|
||||
ut_chhFree (map->m_hh);
|
||||
ddsrt_chh_enum_unsafe (map->m_hh, free_tkmap_instance, NULL);
|
||||
ddsrt_chh_free (map->m_hh);
|
||||
ddsrt_cond_destroy (&map->m_cond);
|
||||
ddsrt_mutex_destroy (&map->m_lock);
|
||||
dds_free (map);
|
||||
|
@ -115,18 +115,18 @@ uint64_t ddsi_tkmap_lookup (struct ddsi_tkmap * map, const struct ddsi_serdata *
|
|||
struct ddsi_tkmap_instance * tk;
|
||||
assert (thread_is_awake ());
|
||||
dummy.m_sample = (struct ddsi_serdata *) sd;
|
||||
tk = ut_chhLookup (map->m_hh, &dummy);
|
||||
tk = ddsrt_chh_lookup (map->m_hh, &dummy);
|
||||
return (tk) ? tk->m_iid : DDS_HANDLE_NIL;
|
||||
}
|
||||
|
||||
struct ddsi_tkmap_instance *ddsi_tkmap_find_by_id (struct ddsi_tkmap *map, uint64_t iid)
|
||||
{
|
||||
/* This is not a function that should be used liberally, as it linearly scans the key-to-iid map. */
|
||||
struct ut_chhIter it;
|
||||
struct ddsrt_chh_iter it;
|
||||
struct ddsi_tkmap_instance *tk;
|
||||
uint32_t refc;
|
||||
assert (thread_is_awake ());
|
||||
for (tk = ut_chhIterFirst (map->m_hh, &it); tk; tk = ut_chhIterNext (&it))
|
||||
for (tk = ddsrt_chh_iter_first (map->m_hh, &it); tk; tk = ddsrt_chh_iter_next (&it))
|
||||
if (tk->m_iid == iid)
|
||||
break;
|
||||
if (tk == NULL)
|
||||
|
@ -165,7 +165,7 @@ ddsi_tkmap_find(
|
|||
assert (thread_is_awake ());
|
||||
dummy.m_sample = sd;
|
||||
retry:
|
||||
if ((tk = ut_chhLookup(map->m_hh, &dummy)) != NULL)
|
||||
if ((tk = ddsrt_chh_lookup(map->m_hh, &dummy)) != NULL)
|
||||
{
|
||||
uint32_t new;
|
||||
new = ddsrt_atomic_inc32_nv(&tk->m_refc);
|
||||
|
@ -178,7 +178,7 @@ retry:
|
|||
we can block until someone signals some entry is removed from the map if we take
|
||||
some lock & wait for some condition */
|
||||
ddsrt_mutex_lock(&map->m_lock);
|
||||
while ((tk = ut_chhLookup(map->m_hh, &dummy)) != NULL && (ddsrt_atomic_ld32(&tk->m_refc) & REFC_DELETE))
|
||||
while ((tk = ddsrt_chh_lookup(map->m_hh, &dummy)) != NULL && (ddsrt_atomic_ld32(&tk->m_refc) & REFC_DELETE))
|
||||
ddsrt_cond_wait(&map->m_cond, &map->m_lock);
|
||||
ddsrt_mutex_unlock(&map->m_lock);
|
||||
goto retry;
|
||||
|
@ -192,7 +192,7 @@ retry:
|
|||
tk->m_sample = ddsi_serdata_to_topicless (sd);
|
||||
ddsrt_atomic_st32 (&tk->m_refc, 1);
|
||||
tk->m_iid = ddsi_iid_gen ();
|
||||
if (!ut_chhAdd (map->m_hh, tk))
|
||||
if (!ddsrt_chh_add (map->m_hh, tk))
|
||||
{
|
||||
/* Lost a race from another thread, retry */
|
||||
ddsi_serdata_unref (tk->m_sample);
|
||||
|
@ -237,7 +237,7 @@ void ddsi_tkmap_instance_unref (struct ddsi_tkmap_instance * tk)
|
|||
struct ddsi_tkmap *map = gv.m_tkmap;
|
||||
|
||||
/* Remove from hash table */
|
||||
int removed = ut_chhRemove(map->m_hh, tk);
|
||||
int removed = ddsrt_chh_remove(map->m_hh, tk);
|
||||
assert (removed);
|
||||
(void)removed;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "dds/ddsrt/log.h"
|
||||
#include "dds/ddsrt/string.h"
|
||||
#include "dds/ddsrt/misc.h"
|
||||
#include "dds/util/ut_avl.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
#include "dds/ddsi/q_log.h"
|
||||
#include "dds/ddsi/q_misc.h"
|
||||
#include "dds/ddsi/q_config.h"
|
||||
|
@ -39,8 +39,8 @@
|
|||
|
||||
static int compare_locators_vwrap (const void *va, const void *vb);
|
||||
|
||||
static const ut_avlCTreedef_t addrset_treedef =
|
||||
UT_AVL_CTREEDEF_INITIALIZER (offsetof (struct addrset_node, avlnode), offsetof (struct addrset_node, loc), compare_locators_vwrap, 0);
|
||||
static const ddsrt_avl_ctreedef_t addrset_treedef =
|
||||
DDSRT_AVL_CTREEDEF_INITIALIZER (offsetof (struct addrset_node, avlnode), offsetof (struct addrset_node, loc), compare_locators_vwrap, 0);
|
||||
|
||||
static int add_addresses_to_addrset_1 (struct addrset *as, const char *ip, int port_mode, const char *msgtag, int req_mc, int mcgen_base, int mcgen_count, int mcgen_idx)
|
||||
{
|
||||
|
@ -203,8 +203,8 @@ struct addrset *new_addrset (void)
|
|||
struct addrset *as = ddsrt_malloc (sizeof (*as));
|
||||
ddsrt_atomic_st32 (&as->refc, 1);
|
||||
ddsrt_mutex_init (&as->lock);
|
||||
ut_avlCInit (&addrset_treedef, &as->ucaddrs);
|
||||
ut_avlCInit (&addrset_treedef, &as->mcaddrs);
|
||||
ddsrt_avl_cinit (&addrset_treedef, &as->ucaddrs);
|
||||
ddsrt_avl_cinit (&addrset_treedef, &as->mcaddrs);
|
||||
return as;
|
||||
}
|
||||
|
||||
|
@ -221,8 +221,8 @@ void unref_addrset (struct addrset *as)
|
|||
{
|
||||
if ((as != NULL) && (ddsrt_atomic_dec32_ov (&as->refc) == 1))
|
||||
{
|
||||
ut_avlCFree (&addrset_treedef, &as->ucaddrs, ddsrt_free);
|
||||
ut_avlCFree (&addrset_treedef, &as->mcaddrs, ddsrt_free);
|
||||
ddsrt_avl_cfree (&addrset_treedef, &as->ucaddrs, ddsrt_free);
|
||||
ddsrt_avl_cfree (&addrset_treedef, &as->mcaddrs, ddsrt_free);
|
||||
ddsrt_mutex_destroy (&as->lock);
|
||||
ddsrt_free (as);
|
||||
}
|
||||
|
@ -247,9 +247,9 @@ int is_unspec_locator (const nn_locator_t *loc)
|
|||
int addrset_contains_ssm (const struct addrset *as)
|
||||
{
|
||||
struct addrset_node *n;
|
||||
ut_avlCIter_t it;
|
||||
ddsrt_avl_citer_t it;
|
||||
LOCK (as);
|
||||
for (n = ut_avlCIterFirst (&addrset_treedef, &as->mcaddrs, &it); n; n = ut_avlCIterNext (&it))
|
||||
for (n = ddsrt_avl_citer_first (&addrset_treedef, &as->mcaddrs, &it); n; n = ddsrt_avl_citer_next (&it))
|
||||
{
|
||||
if (ddsi_is_ssm_mcaddr (&n->loc))
|
||||
{
|
||||
|
@ -264,9 +264,9 @@ int addrset_contains_ssm (const struct addrset *as)
|
|||
int addrset_any_ssm (const struct addrset *as, nn_locator_t *dst)
|
||||
{
|
||||
struct addrset_node *n;
|
||||
ut_avlCIter_t it;
|
||||
ddsrt_avl_citer_t it;
|
||||
LOCK (as);
|
||||
for (n = ut_avlCIterFirst (&addrset_treedef, &as->mcaddrs, &it); n; n = ut_avlCIterNext (&it))
|
||||
for (n = ddsrt_avl_citer_first (&addrset_treedef, &as->mcaddrs, &it); n; n = ddsrt_avl_citer_next (&it))
|
||||
{
|
||||
if (ddsi_is_ssm_mcaddr (&n->loc))
|
||||
{
|
||||
|
@ -282,9 +282,9 @@ int addrset_any_ssm (const struct addrset *as, nn_locator_t *dst)
|
|||
int addrset_any_non_ssm_mc (const struct addrset *as, nn_locator_t *dst)
|
||||
{
|
||||
struct addrset_node *n;
|
||||
ut_avlCIter_t it;
|
||||
ddsrt_avl_citer_t it;
|
||||
LOCK (as);
|
||||
for (n = ut_avlCIterFirst (&addrset_treedef, &as->mcaddrs, &it); n; n = ut_avlCIterNext (&it))
|
||||
for (n = ddsrt_avl_citer_first (&addrset_treedef, &as->mcaddrs, &it); n; n = ddsrt_avl_citer_next (&it))
|
||||
{
|
||||
if (!ddsi_is_ssm_mcaddr (&n->loc))
|
||||
{
|
||||
|
@ -301,8 +301,8 @@ int addrset_any_non_ssm_mc (const struct addrset *as, nn_locator_t *dst)
|
|||
int addrset_purge (struct addrset *as)
|
||||
{
|
||||
LOCK (as);
|
||||
ut_avlCFree (&addrset_treedef, &as->ucaddrs, ddsrt_free);
|
||||
ut_avlCFree (&addrset_treedef, &as->mcaddrs, ddsrt_free);
|
||||
ddsrt_avl_cfree (&addrset_treedef, &as->ucaddrs, ddsrt_free);
|
||||
ddsrt_avl_cfree (&addrset_treedef, &as->mcaddrs, ddsrt_free);
|
||||
UNLOCK (as);
|
||||
return 0;
|
||||
}
|
||||
|
@ -311,14 +311,14 @@ void add_to_addrset (struct addrset *as, const nn_locator_t *loc)
|
|||
{
|
||||
if (!is_unspec_locator (loc))
|
||||
{
|
||||
ut_avlIPath_t path;
|
||||
ut_avlCTree_t *tree = ddsi_is_mcaddr (loc) ? &as->mcaddrs : &as->ucaddrs;
|
||||
ddsrt_avl_ipath_t path;
|
||||
ddsrt_avl_ctree_t *tree = ddsi_is_mcaddr (loc) ? &as->mcaddrs : &as->ucaddrs;
|
||||
LOCK (as);
|
||||
if (ut_avlCLookupIPath (&addrset_treedef, tree, loc, &path) == NULL)
|
||||
if (ddsrt_avl_clookup_ipath (&addrset_treedef, tree, loc, &path) == NULL)
|
||||
{
|
||||
struct addrset_node *n = ddsrt_malloc (sizeof (*n));
|
||||
n->loc = *loc;
|
||||
ut_avlCInsertIPath (&addrset_treedef, tree, n, &path);
|
||||
ddsrt_avl_cinsert_ipath (&addrset_treedef, tree, n, &path);
|
||||
}
|
||||
UNLOCK (as);
|
||||
}
|
||||
|
@ -326,13 +326,13 @@ void add_to_addrset (struct addrset *as, const nn_locator_t *loc)
|
|||
|
||||
void remove_from_addrset (struct addrset *as, const nn_locator_t *loc)
|
||||
{
|
||||
ut_avlDPath_t path;
|
||||
ut_avlCTree_t *tree = ddsi_is_mcaddr (loc) ? &as->mcaddrs : &as->ucaddrs;
|
||||
ddsrt_avl_dpath_t path;
|
||||
ddsrt_avl_ctree_t *tree = ddsi_is_mcaddr (loc) ? &as->mcaddrs : &as->ucaddrs;
|
||||
struct addrset_node *n;
|
||||
LOCK (as);
|
||||
if ((n = ut_avlCLookupDPath (&addrset_treedef, tree, loc, &path)) != NULL)
|
||||
if ((n = ddsrt_avl_clookup_dpath (&addrset_treedef, tree, loc, &path)) != NULL)
|
||||
{
|
||||
ut_avlCDeleteDPath (&addrset_treedef, tree, n, &path);
|
||||
ddsrt_avl_cdelete_dpath (&addrset_treedef, tree, n, &path);
|
||||
ddsrt_free (n);
|
||||
}
|
||||
UNLOCK (as);
|
||||
|
@ -341,9 +341,9 @@ void remove_from_addrset (struct addrset *as, const nn_locator_t *loc)
|
|||
void copy_addrset_into_addrset_uc (struct addrset *as, const struct addrset *asadd)
|
||||
{
|
||||
struct addrset_node *n;
|
||||
ut_avlCIter_t it;
|
||||
ddsrt_avl_citer_t it;
|
||||
LOCK (asadd);
|
||||
for (n = ut_avlCIterFirst (&addrset_treedef, &asadd->ucaddrs, &it); n; n = ut_avlCIterNext (&it))
|
||||
for (n = ddsrt_avl_citer_first (&addrset_treedef, &asadd->ucaddrs, &it); n; n = ddsrt_avl_citer_next (&it))
|
||||
add_to_addrset (as, &n->loc);
|
||||
UNLOCK (asadd);
|
||||
}
|
||||
|
@ -351,9 +351,9 @@ void copy_addrset_into_addrset_uc (struct addrset *as, const struct addrset *asa
|
|||
void copy_addrset_into_addrset_mc (struct addrset *as, const struct addrset *asadd)
|
||||
{
|
||||
struct addrset_node *n;
|
||||
ut_avlCIter_t it;
|
||||
ddsrt_avl_citer_t it;
|
||||
LOCK (asadd);
|
||||
for (n = ut_avlCIterFirst (&addrset_treedef, &asadd->mcaddrs, &it); n; n = ut_avlCIterNext (&it))
|
||||
for (n = ddsrt_avl_citer_first (&addrset_treedef, &asadd->mcaddrs, &it); n; n = ddsrt_avl_citer_next (&it))
|
||||
add_to_addrset (as, &n->loc);
|
||||
UNLOCK (asadd);
|
||||
}
|
||||
|
@ -368,9 +368,9 @@ void copy_addrset_into_addrset (struct addrset *as, const struct addrset *asadd)
|
|||
void copy_addrset_into_addrset_no_ssm_mc (struct addrset *as, const struct addrset *asadd)
|
||||
{
|
||||
struct addrset_node *n;
|
||||
ut_avlCIter_t it;
|
||||
ddsrt_avl_citer_t it;
|
||||
LOCK (asadd);
|
||||
for (n = ut_avlCIterFirst (&addrset_treedef, &asadd->mcaddrs, &it); n; n = ut_avlCIterNext (&it))
|
||||
for (n = ddsrt_avl_citer_first (&addrset_treedef, &asadd->mcaddrs, &it); n; n = ddsrt_avl_citer_next (&it))
|
||||
{
|
||||
if (!ddsi_is_ssm_mcaddr (&n->loc))
|
||||
add_to_addrset (as, &n->loc);
|
||||
|
@ -389,14 +389,14 @@ void addrset_purge_ssm (struct addrset *as)
|
|||
{
|
||||
struct addrset_node *n;
|
||||
LOCK (as);
|
||||
n = ut_avlCFindMin (&addrset_treedef, &as->mcaddrs);
|
||||
n = ddsrt_avl_cfind_min (&addrset_treedef, &as->mcaddrs);
|
||||
while (n)
|
||||
{
|
||||
struct addrset_node *n1 = n;
|
||||
n = ut_avlCFindSucc (&addrset_treedef, &as->mcaddrs, n);
|
||||
n = ddsrt_avl_cfind_succ (&addrset_treedef, &as->mcaddrs, n);
|
||||
if (ddsi_is_ssm_mcaddr (&n1->loc))
|
||||
{
|
||||
ut_avlCDelete (&addrset_treedef, &as->mcaddrs, n1);
|
||||
ddsrt_avl_cdelete (&addrset_treedef, &as->mcaddrs, n1);
|
||||
ddsrt_free (n1);
|
||||
}
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ size_t addrset_count (const struct addrset *as)
|
|||
{
|
||||
size_t count;
|
||||
LOCK (as);
|
||||
count = ut_avlCCount (&as->ucaddrs) + ut_avlCCount (&as->mcaddrs);
|
||||
count = ddsrt_avl_ccount (&as->ucaddrs) + ddsrt_avl_ccount (&as->mcaddrs);
|
||||
UNLOCK (as);
|
||||
return count;
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ size_t addrset_count_uc (const struct addrset *as)
|
|||
{
|
||||
size_t count;
|
||||
LOCK (as);
|
||||
count = ut_avlCCount (&as->ucaddrs);
|
||||
count = ddsrt_avl_ccount (&as->ucaddrs);
|
||||
UNLOCK (as);
|
||||
return count;
|
||||
}
|
||||
|
@ -440,7 +440,7 @@ size_t addrset_count_mc (const struct addrset *as)
|
|||
{
|
||||
size_t count;
|
||||
LOCK (as);
|
||||
count = ut_avlCCount (&as->mcaddrs);
|
||||
count = ddsrt_avl_ccount (&as->mcaddrs);
|
||||
UNLOCK (as);
|
||||
return count;
|
||||
}
|
||||
|
@ -450,7 +450,7 @@ int addrset_empty_uc (const struct addrset *as)
|
|||
{
|
||||
int isempty;
|
||||
LOCK (as);
|
||||
isempty = ut_avlCIsEmpty (&as->ucaddrs);
|
||||
isempty = ddsrt_avl_cis_empty (&as->ucaddrs);
|
||||
UNLOCK (as);
|
||||
return isempty;
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ int addrset_empty_mc (const struct addrset *as)
|
|||
{
|
||||
int isempty;
|
||||
LOCK (as);
|
||||
isempty = ut_avlCIsEmpty (&as->mcaddrs);
|
||||
isempty = ddsrt_avl_cis_empty (&as->mcaddrs);
|
||||
UNLOCK (as);
|
||||
return isempty;
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ int addrset_empty (const struct addrset *as)
|
|||
{
|
||||
int isempty;
|
||||
LOCK (as);
|
||||
isempty = ut_avlCIsEmpty (&as->ucaddrs) && ut_avlCIsEmpty (&as->mcaddrs);
|
||||
isempty = ddsrt_avl_cis_empty (&as->ucaddrs) && ddsrt_avl_cis_empty (&as->mcaddrs);
|
||||
UNLOCK (as);
|
||||
return isempty;
|
||||
}
|
||||
|
@ -476,14 +476,14 @@ int addrset_empty (const struct addrset *as)
|
|||
int addrset_any_uc (const struct addrset *as, nn_locator_t *dst)
|
||||
{
|
||||
LOCK (as);
|
||||
if (ut_avlCIsEmpty (&as->ucaddrs))
|
||||
if (ddsrt_avl_cis_empty (&as->ucaddrs))
|
||||
{
|
||||
UNLOCK (as);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
const struct addrset_node *n = ut_avlCRootNonEmpty (&addrset_treedef, &as->ucaddrs);
|
||||
const struct addrset_node *n = ddsrt_avl_croot_non_empty (&addrset_treedef, &as->ucaddrs);
|
||||
*dst = n->loc;
|
||||
UNLOCK (as);
|
||||
return 1;
|
||||
|
@ -493,14 +493,14 @@ int addrset_any_uc (const struct addrset *as, nn_locator_t *dst)
|
|||
int addrset_any_mc (const struct addrset *as, nn_locator_t *dst)
|
||||
{
|
||||
LOCK (as);
|
||||
if (ut_avlCIsEmpty (&as->mcaddrs))
|
||||
if (ddsrt_avl_cis_empty (&as->mcaddrs))
|
||||
{
|
||||
UNLOCK (as);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
const struct addrset_node *n = ut_avlCRootNonEmpty (&addrset_treedef, &as->mcaddrs);
|
||||
const struct addrset_node *n = ddsrt_avl_croot_non_empty (&addrset_treedef, &as->mcaddrs);
|
||||
*dst = n->loc;
|
||||
UNLOCK (as);
|
||||
return 1;
|
||||
|
@ -527,9 +527,9 @@ size_t addrset_forall_count (struct addrset *as, addrset_forall_fun_t f, void *a
|
|||
arg1.f = f;
|
||||
arg1.arg = arg;
|
||||
LOCK (as);
|
||||
ut_avlCWalk (&addrset_treedef, &as->mcaddrs, addrset_forall_helper, &arg1);
|
||||
ut_avlCWalk (&addrset_treedef, &as->ucaddrs, addrset_forall_helper, &arg1);
|
||||
count = ut_avlCCount (&as->ucaddrs) + ut_avlCCount (&as->mcaddrs);
|
||||
ddsrt_avl_cwalk (&addrset_treedef, &as->mcaddrs, addrset_forall_helper, &arg1);
|
||||
ddsrt_avl_cwalk (&addrset_treedef, &as->ucaddrs, addrset_forall_helper, &arg1);
|
||||
count = ddsrt_avl_ccount (&as->ucaddrs) + ddsrt_avl_ccount (&as->mcaddrs);
|
||||
UNLOCK (as);
|
||||
return count;
|
||||
}
|
||||
|
@ -543,22 +543,22 @@ int addrset_forone (struct addrset *as, addrset_forone_fun_t f, void *arg)
|
|||
{
|
||||
unsigned i;
|
||||
addrset_node_t n;
|
||||
ut_avlCTree_t *trees[2];
|
||||
ut_avlCIter_t iter;
|
||||
ddsrt_avl_ctree_t *trees[2];
|
||||
ddsrt_avl_citer_t iter;
|
||||
|
||||
trees[0] = &as->mcaddrs;
|
||||
trees[1] = &as->ucaddrs;
|
||||
|
||||
for (i = 0; i < 2u; i++)
|
||||
{
|
||||
n = (addrset_node_t) ut_avlCIterFirst (&addrset_treedef, trees[i], &iter);
|
||||
n = (addrset_node_t) ddsrt_avl_citer_first (&addrset_treedef, trees[i], &iter);
|
||||
while (n)
|
||||
{
|
||||
if ((f) (&n->loc, arg) > 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
n = (addrset_node_t) ut_avlCIterNext (&iter);
|
||||
n = (addrset_node_t) ddsrt_avl_citer_next (&iter);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
@ -588,14 +588,14 @@ void nn_log_addrset (uint32_t tf, const char *prefix, const struct addrset *as)
|
|||
}
|
||||
}
|
||||
|
||||
static int addrset_eq_onesidederr1 (const ut_avlCTree_t *at, const ut_avlCTree_t *bt)
|
||||
static int addrset_eq_onesidederr1 (const ddsrt_avl_ctree_t *at, const ddsrt_avl_ctree_t *bt)
|
||||
{
|
||||
/* Just checking the root */
|
||||
if (ut_avlCIsEmpty (at) && ut_avlCIsEmpty (bt)) {
|
||||
if (ddsrt_avl_cis_empty (at) && ddsrt_avl_cis_empty (bt)) {
|
||||
return 1;
|
||||
} else if (ut_avlCIsSingleton (at) && ut_avlCIsSingleton (bt)) {
|
||||
const struct addrset_node *a = ut_avlCRootNonEmpty (&addrset_treedef, at);
|
||||
const struct addrset_node *b = ut_avlCRootNonEmpty (&addrset_treedef, bt);
|
||||
} else if (ddsrt_avl_cis_singleton (at) && ddsrt_avl_cis_singleton (bt)) {
|
||||
const struct addrset_node *a = ddsrt_avl_croot_non_empty (&addrset_treedef, at);
|
||||
const struct addrset_node *b = ddsrt_avl_croot_non_empty (&addrset_treedef, bt);
|
||||
return compare_locators (&a->loc, &b->loc) == 0;
|
||||
} else {
|
||||
return 0;
|
||||
|
|
|
@ -24,15 +24,15 @@
|
|||
#include "dds/ddsrt/misc.h"
|
||||
#include "dds/ddsi/q_config.h"
|
||||
#include "dds/ddsi/q_log.h"
|
||||
#include "dds/util/ut_avl.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
#include "dds/ddsi/q_unused.h"
|
||||
#include "dds/ddsi/q_misc.h"
|
||||
#include "dds/ddsi/q_addrset.h"
|
||||
#include "dds/ddsi/q_nwif.h"
|
||||
#include "dds/ddsi/q_error.h"
|
||||
|
||||
#include "dds/util/ut_xmlparser.h"
|
||||
#include "dds/util/ut_expand_envvars.h"
|
||||
#include "dds/ddsrt/xmlparser.h"
|
||||
#include "dds/ddsrt/expand_envvars.h"
|
||||
|
||||
#include "dds/version.h"
|
||||
|
||||
|
@ -77,7 +77,7 @@ struct cfgst_nodekey {
|
|||
};
|
||||
|
||||
struct cfgst_node {
|
||||
ut_avlNode_t avlnode;
|
||||
ddsrt_avl_node_t avlnode;
|
||||
struct cfgst_nodekey key;
|
||||
int count;
|
||||
int failed;
|
||||
|
@ -85,7 +85,7 @@ struct cfgst_node {
|
|||
};
|
||||
|
||||
struct cfgst {
|
||||
ut_avlTree_t found;
|
||||
ddsrt_avl_tree_t found;
|
||||
struct config *cfg;
|
||||
/* error flag set so that we can continue parsing for some errors and still fail properly */
|
||||
int error;
|
||||
|
@ -119,8 +119,8 @@ the configuration, so we update this variable instead. */
|
|||
static uint32_t enabled_logcats;
|
||||
|
||||
static int cfgst_node_cmp(const void *va, const void *vb);
|
||||
static const ut_avlTreedef_t cfgst_found_treedef =
|
||||
UT_AVL_TREEDEF_INITIALIZER(offsetof(struct cfgst_node, avlnode), offsetof(struct cfgst_node, key), cfgst_node_cmp, 0);
|
||||
static const ddsrt_avl_treedef_t cfgst_found_treedef =
|
||||
DDSRT_AVL_TREEDEF_INITIALIZER(offsetof(struct cfgst_node, avlnode), offsetof(struct cfgst_node, key), cfgst_node_cmp, 0);
|
||||
|
||||
#define DU(fname) static int uf_##fname (struct cfgst *cfgst, void *parent, struct cfgelem const * const cfgelem, int first, const char *value)
|
||||
#define PF(fname) static void pf_##fname (struct cfgst *cfgst, void *parent, struct cfgelem const * const cfgelem, int is_default)
|
||||
|
@ -2067,10 +2067,10 @@ static int do_update(struct cfgst *cfgst, update_fun_t upd, void *parent, struct
|
|||
{
|
||||
struct cfgst_node *n;
|
||||
struct cfgst_nodekey key;
|
||||
ut_avlIPath_t np;
|
||||
ddsrt_avl_ipath_t np;
|
||||
int ok;
|
||||
key.e = cfgelem;
|
||||
if ( (n = ut_avlLookupIPath(&cfgst_found_treedef, &cfgst->found, &key, &np)) == NULL ) {
|
||||
if ( (n = ddsrt_avl_lookup_ipath(&cfgst_found_treedef, &cfgst->found, &key, &np)) == NULL ) {
|
||||
if ( (n = ddsrt_malloc(sizeof(*n))) == NULL )
|
||||
return cfg_error(cfgst, "out of memory");
|
||||
|
||||
|
@ -2078,7 +2078,7 @@ static int do_update(struct cfgst *cfgst, update_fun_t upd, void *parent, struct
|
|||
n->count = 0;
|
||||
n->failed = 0;
|
||||
n->is_default = is_default;
|
||||
ut_avlInsertIPath(&cfgst_found_treedef, &cfgst->found, n, &np);
|
||||
ddsrt_avl_insert_ipath(&cfgst_found_treedef, &cfgst->found, n, &np);
|
||||
}
|
||||
if ( cfgelem->multiplicity == 0 || n->count < cfgelem->multiplicity )
|
||||
ok = upd(cfgst, parent, cfgelem, (n->count == n->failed), value);
|
||||
|
@ -2108,7 +2108,7 @@ static int set_defaults(struct cfgst *cfgst, void *parent, int isattr, struct cf
|
|||
key.e = ce;
|
||||
cfgst_push(cfgst, isattr, ce, parent);
|
||||
if ( ce->multiplicity == 1 ) {
|
||||
if ( ut_avlLookup(&cfgst_found_treedef, &cfgst->found, &key) == NULL ) {
|
||||
if ( ddsrt_avl_lookup(&cfgst_found_treedef, &cfgst->found, &key) == NULL ) {
|
||||
if ( ce->update ) {
|
||||
int ok1;
|
||||
cfgst_push(cfgst, 0, NULL, NULL);
|
||||
|
@ -2117,9 +2117,9 @@ static int set_defaults(struct cfgst *cfgst, void *parent, int isattr, struct cf
|
|||
ok = ok && ok1;
|
||||
}
|
||||
}
|
||||
if ( (n = ut_avlLookup(&cfgst_found_treedef, &cfgst->found, &key)) != NULL ) {
|
||||
if ( (n = ddsrt_avl_lookup(&cfgst_found_treedef, &cfgst->found, &key)) != NULL ) {
|
||||
if ( clear_found ) {
|
||||
ut_avlDelete(&cfgst_found_treedef, &cfgst->found, n);
|
||||
ddsrt_avl_delete(&cfgst_found_treedef, &cfgst->found, n);
|
||||
ddsrt_free(n);
|
||||
}
|
||||
}
|
||||
|
@ -2419,7 +2419,7 @@ static void print_configitems(struct cfgst *cfgst, void *parent, int isattr, str
|
|||
key.e = ce;
|
||||
cfgst_push(cfgst, isattr, ce, parent);
|
||||
if ( ce->multiplicity == 1 ) {
|
||||
if ( (n = ut_avlLookup(&cfgst_found_treedef, &cfgst->found, &key)) != NULL ) {
|
||||
if ( (n = ddsrt_avl_lookup(&cfgst_found_treedef, &cfgst->found, &key)) != NULL ) {
|
||||
cfgst_push(cfgst, 0, NULL, NULL);
|
||||
ce->print(cfgst, parent, ce, n->is_default);
|
||||
cfgst_pop(cfgst);
|
||||
|
@ -2496,7 +2496,7 @@ static void free_configured_elements(struct cfgst *cfgst, void *parent, struct c
|
|||
if ( ce->name[0] == '>' ) /* moved, so don't care */
|
||||
continue;
|
||||
key.e = ce;
|
||||
if ( (n = ut_avlLookup(&cfgst_found_treedef, &cfgst->found, &key)) != NULL ) {
|
||||
if ( (n = ddsrt_avl_lookup(&cfgst_found_treedef, &cfgst->found, &key)) != NULL ) {
|
||||
if ( ce->free && n->count > n->failed )
|
||||
ce->free(cfgst, parent, ce);
|
||||
}
|
||||
|
@ -2646,7 +2646,7 @@ static int proc_attr(void *varg, UNUSED_ARG(uintptr_t eleminfo), const char *nam
|
|||
return cfg_error(cfgst, "%s: unknown attribute", name);
|
||||
else {
|
||||
void *parent = cfgst_parent(cfgst);
|
||||
char *xvalue = ut_expand_envvars(value);
|
||||
char *xvalue = ddsrt_expand_envvars(value);
|
||||
int ok;
|
||||
cfgst_push(cfgst, 1, cfg_attr, parent);
|
||||
ok = do_update(cfgst, cfg_attr->update, parent, cfg_attr, xvalue, 0);
|
||||
|
@ -2666,7 +2666,7 @@ static int proc_elem_data(void *varg, UNUSED_ARG(uintptr_t eleminfo), const char
|
|||
return cfg_error(cfgst, "%s: no data expected", value);
|
||||
else {
|
||||
void *parent = cfgst_parent(cfgst);
|
||||
char *xvalue = ut_expand_envvars(value);
|
||||
char *xvalue = ddsrt_expand_envvars(value);
|
||||
int ok;
|
||||
cfgst_push(cfgst, 0, NULL, parent);
|
||||
ok = do_update(cfgst, cfgelem->update, parent, cfgelem, xvalue, 0);
|
||||
|
@ -2802,14 +2802,14 @@ struct cfgst * config_init (const char *configfile)
|
|||
cfgst = ddsrt_malloc(sizeof(*cfgst));
|
||||
memset(cfgst, 0, sizeof(*cfgst));
|
||||
|
||||
ut_avlInit(&cfgst_found_treedef, &cfgst->found);
|
||||
ddsrt_avl_init(&cfgst_found_treedef, &cfgst->found);
|
||||
cfgst->cfg = &config;
|
||||
cfgst->error = 0;
|
||||
|
||||
/* configfile == NULL will get you the default configuration */
|
||||
if (configfile) {
|
||||
char *copy = ddsrt_strdup(configfile), *cursor = copy;
|
||||
struct ut_xmlpCallbacks cb;
|
||||
struct ddsrt_xmlp_callbacks cb;
|
||||
|
||||
cb.attr = proc_attr;
|
||||
cb.elem_close = proc_elem_close;
|
||||
|
@ -2818,14 +2818,14 @@ struct cfgst * config_init (const char *configfile)
|
|||
cb.error = proc_error;
|
||||
|
||||
while (ok && cursor && cursor[0]) {
|
||||
struct ut_xmlpState *qx;
|
||||
struct ddsrt_xmlp_state *qx;
|
||||
FILE *fp;
|
||||
char *tok;
|
||||
tok = cursor;
|
||||
if (tok[0] == '<') {
|
||||
/* Read XML directly from input string */
|
||||
qx = ut_xmlpNewString (tok, cfgst, &cb);
|
||||
ut_xmlpSetRequireEOF (qx, 0);
|
||||
qx = ddsrt_xmlp_new_string (tok, cfgst, &cb);
|
||||
ddsrt_xmlp_set_requireEOF (qx, 0);
|
||||
fp = NULL;
|
||||
} else {
|
||||
char *comma;
|
||||
|
@ -2845,11 +2845,11 @@ struct cfgst * config_init (const char *configfile)
|
|||
}
|
||||
}
|
||||
DDSRT_WARNING_MSVC_ON(4996);
|
||||
qx = ut_xmlpNewFile(fp, cfgst, &cb);
|
||||
qx = ddsrt_xmlp_new_file(fp, cfgst, &cb);
|
||||
}
|
||||
cfgst_push(cfgst, 0, &root_cfgelem, &config);
|
||||
|
||||
ok = (ut_xmlpParse(qx) >= 0) && !cfgst->error;
|
||||
ok = (ddsrt_xmlp_parse(qx) >= 0) && !cfgst->error;
|
||||
/* Pop until stack empty: error handling is rather brutal */
|
||||
assert(!ok || cfgst->path_depth == 1);
|
||||
while (cfgst->path_depth > 0) {
|
||||
|
@ -2858,9 +2858,9 @@ struct cfgst * config_init (const char *configfile)
|
|||
if (fp) {
|
||||
fclose(fp);
|
||||
} else if (ok) {
|
||||
cursor = tok + ut_xmlpGetBufpos (qx);
|
||||
cursor = tok + ddsrt_xmlp_get_bufpos (qx);
|
||||
}
|
||||
ut_xmlpFree(qx);
|
||||
ddsrt_xmlp_free(qx);
|
||||
while (cursor && cursor[0] == ',') {
|
||||
cursor++;
|
||||
}
|
||||
|
@ -3019,7 +3019,7 @@ struct cfgst * config_init (const char *configfile)
|
|||
config.valid = 1;
|
||||
return cfgst;
|
||||
} else {
|
||||
ut_avlFree(&cfgst_found_treedef, &cfgst->found, ddsrt_free);
|
||||
ddsrt_avl_free(&cfgst_found_treedef, &cfgst->found, ddsrt_free);
|
||||
ddsrt_free(cfgst);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -3047,7 +3047,7 @@ void config_fini(struct cfgst *cfgst)
|
|||
memset(&config, 0, sizeof(config));
|
||||
config.valid = 0;
|
||||
|
||||
ut_avlFree(&cfgst_found_treedef, &cfgst->found, ddsrt_free);
|
||||
ddsrt_avl_free(&cfgst_found_treedef, &cfgst->found, ddsrt_free);
|
||||
ddsrt_free(cfgst);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "dds/ddsrt/log.h"
|
||||
#include "dds/ddsrt/md5.h"
|
||||
#include "dds/ddsrt/sync.h"
|
||||
#include "dds/util/ut_avl.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
#include "dds/ddsi/q_protocol.h"
|
||||
#include "dds/ddsi/q_rtps.h"
|
||||
#include "dds/ddsi/q_misc.h"
|
||||
|
@ -1767,7 +1767,7 @@ int builtins_dqueue_handler (const struct nn_rsample_info *sampleinfo, const str
|
|||
statusinfo = (qos.present & PP_STATUSINFO) ? qos.statusinfo : 0;
|
||||
}
|
||||
|
||||
if (pwr && ut_avlIsEmpty (&pwr->readers))
|
||||
if (pwr && ddsrt_avl_is_empty (&pwr->readers))
|
||||
{
|
||||
/* Wasn't empty when enqueued, but needn't still be; SPDP has no
|
||||
proxy writer, and is always accepted */
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "dds/ddsrt/sync.h"
|
||||
#include "dds/ddsrt/misc.h"
|
||||
|
||||
#include "dds/util/ut_avl.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
|
||||
#include "dds/ddsi/q_entity.h"
|
||||
#include "dds/ddsi/q_config.h"
|
||||
|
@ -161,7 +161,7 @@ static int print_participants (struct thread_state1 * const ts1, ddsi_tran_conn_
|
|||
ephash_enum_reader_init (&er);
|
||||
while ((r = ephash_enum_reader_next (&er)) != NULL)
|
||||
{
|
||||
ut_avlIter_t writ;
|
||||
ddsrt_avl_iter_t writ;
|
||||
struct rd_pwr_match *m;
|
||||
if (r->c.pp != p)
|
||||
continue;
|
||||
|
@ -170,7 +170,7 @@ static int print_participants (struct thread_state1 * const ts1, ddsi_tran_conn_
|
|||
#ifdef DDSI_INCLUDE_NETWORK_PARTITIONS
|
||||
x += print_addrset_if_notempty (conn, " as", r->as, "\n");
|
||||
#endif
|
||||
for (m = ut_avlIterFirst (&rd_writers_treedef, &r->writers, &writ); m; m = ut_avlIterNext (&writ))
|
||||
for (m = ddsrt_avl_iter_first (&rd_writers_treedef, &r->writers, &writ); m; m = ddsrt_avl_iter_next (&writ))
|
||||
x += cpf (conn, " pwr %x:%x:%x:%x\n", PGUID (m->pwr_guid));
|
||||
ddsrt_mutex_unlock (&r->e.lock);
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ static int print_participants (struct thread_state1 * const ts1, ddsi_tran_conn_
|
|||
ephash_enum_writer_init (&ew);
|
||||
while ((w = ephash_enum_writer_next (&ew)) != NULL)
|
||||
{
|
||||
ut_avlIter_t rdit;
|
||||
ddsrt_avl_iter_t rdit;
|
||||
struct wr_prd_match *m;
|
||||
struct whc_state whcst;
|
||||
if (w->c.pp != p)
|
||||
|
@ -207,7 +207,7 @@ static int print_participants (struct thread_state1 * const ts1, ddsi_tran_conn_
|
|||
x += cpf (conn, " max-drop-seq %lld\n", writer_max_drop_seq (w));
|
||||
}
|
||||
x += print_addrset_if_notempty (conn, " as", w->as, "\n");
|
||||
for (m = ut_avlIterFirst (&wr_readers_treedef, &w->readers, &rdit); m; m = ut_avlIterNext (&rdit))
|
||||
for (m = ddsrt_avl_iter_first (&wr_readers_treedef, &w->readers, &rdit); m; m = ddsrt_avl_iter_next (&rdit))
|
||||
{
|
||||
char wr_prd_flags[4];
|
||||
wr_prd_flags[0] = m->is_reliable ? 'R' : 'U';
|
||||
|
@ -248,13 +248,13 @@ static int print_proxy_participants (struct thread_state1 * const ts1, ddsi_tran
|
|||
ephash_enum_proxy_reader_init (&er);
|
||||
while ((r = ephash_enum_proxy_reader_next (&er)) != NULL)
|
||||
{
|
||||
ut_avlIter_t writ;
|
||||
ddsrt_avl_iter_t writ;
|
||||
struct prd_wr_match *m;
|
||||
if (r->c.proxypp != p)
|
||||
continue;
|
||||
ddsrt_mutex_lock (&r->e.lock);
|
||||
print_proxy_endpoint_common (conn, "prd", &r->e, &r->c);
|
||||
for (m = ut_avlIterFirst (&rd_writers_treedef, &r->writers, &writ); m; m = ut_avlIterNext (&writ))
|
||||
for (m = ddsrt_avl_iter_first (&rd_writers_treedef, &r->writers, &writ); m; m = ddsrt_avl_iter_next (&writ))
|
||||
x += cpf (conn, " wr %x:%x:%x:%x\n", PGUID (m->wr_guid));
|
||||
ddsrt_mutex_unlock (&r->e.lock);
|
||||
}
|
||||
|
@ -267,14 +267,14 @@ static int print_proxy_participants (struct thread_state1 * const ts1, ddsi_tran
|
|||
ephash_enum_proxy_writer_init (&ew);
|
||||
while ((w = ephash_enum_proxy_writer_next (&ew)) != NULL)
|
||||
{
|
||||
ut_avlIter_t rdit;
|
||||
ddsrt_avl_iter_t rdit;
|
||||
struct pwr_rd_match *m;
|
||||
if (w->c.proxypp != p)
|
||||
continue;
|
||||
ddsrt_mutex_lock (&w->e.lock);
|
||||
print_proxy_endpoint_common (conn, "pwr", &w->e, &w->c);
|
||||
x += cpf (conn, " last_seq %lld last_fragnum %u\n", w->last_seq, w->last_fragnum);
|
||||
for (m = ut_avlIterFirst (&wr_readers_treedef, &w->readers, &rdit); m; m = ut_avlIterNext (&rdit))
|
||||
for (m = ddsrt_avl_iter_first (&wr_readers_treedef, &w->readers, &rdit); m; m = ddsrt_avl_iter_next (&rdit))
|
||||
{
|
||||
x += cpf (conn, " rd %x:%x:%x:%x (nack %lld %lld)\n",
|
||||
PGUID (m->rd_guid), m->seq_last_nack, m->t_last_nack);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "dds/ddsi/q_time.h"
|
||||
#include "dds/ddsi/q_misc.h"
|
||||
#include "dds/ddsi/q_log.h"
|
||||
#include "dds/util/ut_avl.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
#include "dds/ddsi/q_plist.h"
|
||||
#include "dds/ddsi/q_lease.h"
|
||||
#include "dds/ddsi/q_qosmatch.h"
|
||||
|
@ -49,34 +49,34 @@
|
|||
#include "dds/ddsi/ddsi_tkmap.h"
|
||||
|
||||
struct deleted_participant {
|
||||
ut_avlNode_t avlnode;
|
||||
ddsrt_avl_node_t avlnode;
|
||||
nn_guid_t guid;
|
||||
unsigned for_what;
|
||||
nn_mtime_t t_prune;
|
||||
};
|
||||
|
||||
static ddsrt_mutex_t deleted_participants_lock;
|
||||
static ut_avlTree_t deleted_participants;
|
||||
static ddsrt_avl_tree_t deleted_participants;
|
||||
|
||||
static int compare_guid (const void *va, const void *vb);
|
||||
static void augment_wr_prd_match (void *vnode, const void *vleft, const void *vright);
|
||||
|
||||
const ut_avlTreedef_t wr_readers_treedef =
|
||||
UT_AVL_TREEDEF_INITIALIZER (offsetof (struct wr_prd_match, avlnode), offsetof (struct wr_prd_match, prd_guid), compare_guid, augment_wr_prd_match);
|
||||
const ut_avlTreedef_t wr_local_readers_treedef =
|
||||
UT_AVL_TREEDEF_INITIALIZER (offsetof (struct wr_rd_match, avlnode), offsetof (struct wr_rd_match, rd_guid), compare_guid, 0);
|
||||
const ut_avlTreedef_t rd_writers_treedef =
|
||||
UT_AVL_TREEDEF_INITIALIZER (offsetof (struct rd_pwr_match, avlnode), offsetof (struct rd_pwr_match, pwr_guid), compare_guid, 0);
|
||||
const ut_avlTreedef_t rd_local_writers_treedef =
|
||||
UT_AVL_TREEDEF_INITIALIZER (offsetof (struct rd_wr_match, avlnode), offsetof (struct rd_wr_match, wr_guid), compare_guid, 0);
|
||||
const ut_avlTreedef_t pwr_readers_treedef =
|
||||
UT_AVL_TREEDEF_INITIALIZER (offsetof (struct pwr_rd_match, avlnode), offsetof (struct pwr_rd_match, rd_guid), compare_guid, 0);
|
||||
const ut_avlTreedef_t prd_writers_treedef =
|
||||
UT_AVL_TREEDEF_INITIALIZER (offsetof (struct prd_wr_match, avlnode), offsetof (struct prd_wr_match, wr_guid), compare_guid, 0);
|
||||
const ut_avlTreedef_t deleted_participants_treedef =
|
||||
UT_AVL_TREEDEF_INITIALIZER (offsetof (struct deleted_participant, avlnode), offsetof (struct deleted_participant, guid), compare_guid, 0);
|
||||
const ut_avlTreedef_t proxypp_groups_treedef =
|
||||
UT_AVL_TREEDEF_INITIALIZER (offsetof (struct proxy_group, avlnode), offsetof (struct proxy_group, guid), compare_guid, 0);
|
||||
const ddsrt_avl_treedef_t wr_readers_treedef =
|
||||
DDSRT_AVL_TREEDEF_INITIALIZER (offsetof (struct wr_prd_match, avlnode), offsetof (struct wr_prd_match, prd_guid), compare_guid, augment_wr_prd_match);
|
||||
const ddsrt_avl_treedef_t wr_local_readers_treedef =
|
||||
DDSRT_AVL_TREEDEF_INITIALIZER (offsetof (struct wr_rd_match, avlnode), offsetof (struct wr_rd_match, rd_guid), compare_guid, 0);
|
||||
const ddsrt_avl_treedef_t rd_writers_treedef =
|
||||
DDSRT_AVL_TREEDEF_INITIALIZER (offsetof (struct rd_pwr_match, avlnode), offsetof (struct rd_pwr_match, pwr_guid), compare_guid, 0);
|
||||
const ddsrt_avl_treedef_t rd_local_writers_treedef =
|
||||
DDSRT_AVL_TREEDEF_INITIALIZER (offsetof (struct rd_wr_match, avlnode), offsetof (struct rd_wr_match, wr_guid), compare_guid, 0);
|
||||
const ddsrt_avl_treedef_t pwr_readers_treedef =
|
||||
DDSRT_AVL_TREEDEF_INITIALIZER (offsetof (struct pwr_rd_match, avlnode), offsetof (struct pwr_rd_match, rd_guid), compare_guid, 0);
|
||||
const ddsrt_avl_treedef_t prd_writers_treedef =
|
||||
DDSRT_AVL_TREEDEF_INITIALIZER (offsetof (struct prd_wr_match, avlnode), offsetof (struct prd_wr_match, wr_guid), compare_guid, 0);
|
||||
const ddsrt_avl_treedef_t deleted_participants_treedef =
|
||||
DDSRT_AVL_TREEDEF_INITIALIZER (offsetof (struct deleted_participant, avlnode), offsetof (struct deleted_participant, guid), compare_guid, 0);
|
||||
const ddsrt_avl_treedef_t proxypp_groups_treedef =
|
||||
DDSRT_AVL_TREEDEF_INITIALIZER (offsetof (struct proxy_group, avlnode), offsetof (struct proxy_group, guid), compare_guid, 0);
|
||||
|
||||
static const unsigned builtin_writers_besmask =
|
||||
NN_DISC_BUILTIN_ENDPOINT_PARTICIPANT_ANNOUNCER |
|
||||
|
@ -267,13 +267,13 @@ nn_vendorid_t get_entity_vendorid (const struct entity_common *e)
|
|||
int deleted_participants_admin_init (void)
|
||||
{
|
||||
ddsrt_mutex_init (&deleted_participants_lock);
|
||||
ut_avlInit (&deleted_participants_treedef, &deleted_participants);
|
||||
ddsrt_avl_init (&deleted_participants_treedef, &deleted_participants);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void deleted_participants_admin_fini (void)
|
||||
{
|
||||
ut_avlFree (&deleted_participants_treedef, &deleted_participants, ddsrt_free);
|
||||
ddsrt_avl_free (&deleted_participants_treedef, &deleted_participants, ddsrt_free);
|
||||
ddsrt_mutex_destroy (&deleted_participants_lock);
|
||||
}
|
||||
|
||||
|
@ -283,13 +283,13 @@ static void prune_deleted_participant_guids_unlocked (nn_mtime_t tnow)
|
|||
all circumstances, but I expect the tree to be very small at all
|
||||
times, so a full scan is fine, too ... */
|
||||
struct deleted_participant *dpp;
|
||||
dpp = ut_avlFindMin (&deleted_participants_treedef, &deleted_participants);
|
||||
dpp = ddsrt_avl_find_min (&deleted_participants_treedef, &deleted_participants);
|
||||
while (dpp)
|
||||
{
|
||||
struct deleted_participant *dpp1 = ut_avlFindSucc (&deleted_participants_treedef, &deleted_participants, dpp);
|
||||
struct deleted_participant *dpp1 = ddsrt_avl_find_succ (&deleted_participants_treedef, &deleted_participants, dpp);
|
||||
if (dpp->t_prune.v < tnow.v)
|
||||
{
|
||||
ut_avlDelete (&deleted_participants_treedef, &deleted_participants, dpp);
|
||||
ddsrt_avl_delete (&deleted_participants_treedef, &deleted_participants, dpp);
|
||||
ddsrt_free (dpp);
|
||||
}
|
||||
dpp = dpp1;
|
||||
|
@ -306,16 +306,16 @@ static void prune_deleted_participant_guids (nn_mtime_t tnow)
|
|||
static void remember_deleted_participant_guid (const struct nn_guid *guid)
|
||||
{
|
||||
struct deleted_participant *n;
|
||||
ut_avlIPath_t path;
|
||||
ddsrt_avl_ipath_t path;
|
||||
ddsrt_mutex_lock (&deleted_participants_lock);
|
||||
if (ut_avlLookupIPath (&deleted_participants_treedef, &deleted_participants, guid, &path) == NULL)
|
||||
if (ddsrt_avl_lookup_ipath (&deleted_participants_treedef, &deleted_participants, guid, &path) == NULL)
|
||||
{
|
||||
if ((n = ddsrt_malloc (sizeof (*n))) != NULL)
|
||||
{
|
||||
n->guid = *guid;
|
||||
n->t_prune.v = T_NEVER;
|
||||
n->for_what = DPG_LOCAL | DPG_REMOTE;
|
||||
ut_avlInsertIPath (&deleted_participants_treedef, &deleted_participants, n, &path);
|
||||
ddsrt_avl_insert_ipath (&deleted_participants_treedef, &deleted_participants, n, &path);
|
||||
}
|
||||
}
|
||||
ddsrt_mutex_unlock (&deleted_participants_lock);
|
||||
|
@ -327,7 +327,7 @@ int is_deleted_participant_guid (const struct nn_guid *guid, unsigned for_what)
|
|||
int known;
|
||||
ddsrt_mutex_lock (&deleted_participants_lock);
|
||||
prune_deleted_participant_guids_unlocked (now_mt());
|
||||
if ((n = ut_avlLookup (&deleted_participants_treedef, &deleted_participants, guid)) == NULL)
|
||||
if ((n = ddsrt_avl_lookup (&deleted_participants_treedef, &deleted_participants, guid)) == NULL)
|
||||
known = 0;
|
||||
else
|
||||
known = ((n->for_what & for_what) != 0);
|
||||
|
@ -340,7 +340,7 @@ static void remove_deleted_participant_guid (const struct nn_guid *guid, unsigne
|
|||
struct deleted_participant *n;
|
||||
DDS_LOG(DDS_LC_DISCOVERY, "remove_deleted_participant_guid(%x:%x:%x:%x for_what=%x)\n", PGUID (*guid), for_what);
|
||||
ddsrt_mutex_lock (&deleted_participants_lock);
|
||||
if ((n = ut_avlLookup (&deleted_participants_treedef, &deleted_participants, guid)) != NULL)
|
||||
if ((n = ddsrt_avl_lookup (&deleted_participants_treedef, &deleted_participants, guid)) != NULL)
|
||||
{
|
||||
if (config.prune_deleted_ppant.enforce_delay)
|
||||
{
|
||||
|
@ -357,7 +357,7 @@ static void remove_deleted_participant_guid (const struct nn_guid *guid, unsigne
|
|||
}
|
||||
else
|
||||
{
|
||||
ut_avlDelete (&deleted_participants_treedef, &deleted_participants, n);
|
||||
ddsrt_avl_delete (&deleted_participants_treedef, &deleted_participants, n);
|
||||
ddsrt_free (n);
|
||||
}
|
||||
}
|
||||
|
@ -971,13 +971,13 @@ static struct addrset *rebuild_make_all_addrs (int *nreaders, struct writer *wr)
|
|||
{
|
||||
struct addrset *all_addrs = new_addrset();
|
||||
struct wr_prd_match *m;
|
||||
ut_avlIter_t it;
|
||||
ddsrt_avl_iter_t it;
|
||||
#ifdef DDSI_INCLUDE_SSM
|
||||
if (wr->supports_ssm && wr->ssm_as)
|
||||
copy_addrset_into_addrset_mc (all_addrs, wr->ssm_as);
|
||||
#endif
|
||||
*nreaders = 0;
|
||||
for (m = ut_avlIterFirst (&wr_readers_treedef, &wr->readers, &it); m; m = ut_avlIterNext (&it))
|
||||
for (m = ddsrt_avl_iter_first (&wr_readers_treedef, &wr->readers, &it); m; m = ddsrt_avl_iter_next (&it))
|
||||
{
|
||||
struct proxy_reader *prd;
|
||||
if ((prd = ephash_lookup_proxy_reader_guid (&m->prd_guid)) == NULL)
|
||||
|
@ -1030,7 +1030,7 @@ static void rebuild_make_covered(int8_t **covered, const struct writer *wr, int
|
|||
{
|
||||
struct rebuild_flatten_locs_arg flarg;
|
||||
struct wr_prd_match *m;
|
||||
ut_avlIter_t it;
|
||||
ddsrt_avl_iter_t it;
|
||||
int rdidx, i, j;
|
||||
int8_t *cov = ddsrt_malloc((size_t) *nreaders * (size_t) nlocs * sizeof (*cov));
|
||||
for (i = 0; i < *nreaders * nlocs; i++)
|
||||
|
@ -1040,7 +1040,7 @@ static void rebuild_make_covered(int8_t **covered, const struct writer *wr, int
|
|||
#ifndef NDEBUG
|
||||
flarg.size = nlocs;
|
||||
#endif
|
||||
for (m = ut_avlIterFirst (&wr_readers_treedef, &wr->readers, &it); m; m = ut_avlIterNext (&it))
|
||||
for (m = ddsrt_avl_iter_first (&wr_readers_treedef, &wr->readers, &it); m; m = ddsrt_avl_iter_next (&it))
|
||||
{
|
||||
struct proxy_reader *prd;
|
||||
struct addrset *ass[] = { NULL, NULL, NULL };
|
||||
|
@ -1337,10 +1337,10 @@ static void writer_drop_connection (const struct nn_guid * wr_guid, const struct
|
|||
struct whc_node *deferred_free_list = NULL;
|
||||
struct wr_prd_match *m;
|
||||
ddsrt_mutex_lock (&wr->e.lock);
|
||||
if ((m = ut_avlLookup (&wr_readers_treedef, &wr->readers, &prd->e.guid)) != NULL)
|
||||
if ((m = ddsrt_avl_lookup (&wr_readers_treedef, &wr->readers, &prd->e.guid)) != NULL)
|
||||
{
|
||||
struct whc_state whcst;
|
||||
ut_avlDelete (&wr_readers_treedef, &wr->readers, m);
|
||||
ddsrt_avl_delete (&wr_readers_treedef, &wr->readers, m);
|
||||
rebuild_writer_addrset (wr);
|
||||
remove_acked_messages (wr, &whcst, &deferred_free_list);
|
||||
wr->num_reliable_readers -= m->is_reliable;
|
||||
|
@ -1368,9 +1368,9 @@ static void writer_drop_local_connection (const struct nn_guid *wr_guid, struct
|
|||
struct wr_rd_match *m;
|
||||
|
||||
ddsrt_mutex_lock (&wr->e.lock);
|
||||
if ((m = ut_avlLookup (&wr_local_readers_treedef, &wr->local_readers, &rd->e.guid)) != NULL)
|
||||
if ((m = ddsrt_avl_lookup (&wr_local_readers_treedef, &wr->local_readers, &rd->e.guid)) != NULL)
|
||||
{
|
||||
ut_avlDelete (&wr_local_readers_treedef, &wr->local_readers, m);
|
||||
ddsrt_avl_delete (&wr_local_readers_treedef, &wr->local_readers, m);
|
||||
local_reader_ary_remove (&wr->rdary, rd);
|
||||
}
|
||||
ddsrt_mutex_unlock (&wr->e.lock);
|
||||
|
@ -1393,8 +1393,8 @@ static void reader_drop_connection (const struct nn_guid *rd_guid, const struct
|
|||
{
|
||||
struct rd_pwr_match *m;
|
||||
ddsrt_mutex_lock (&rd->e.lock);
|
||||
if ((m = ut_avlLookup (&rd_writers_treedef, &rd->writers, &pwr->e.guid)) != NULL)
|
||||
ut_avlDelete (&rd_writers_treedef, &rd->writers, m);
|
||||
if ((m = ddsrt_avl_lookup (&rd_writers_treedef, &rd->writers, &pwr->e.guid)) != NULL)
|
||||
ddsrt_avl_delete (&rd_writers_treedef, &rd->writers, m);
|
||||
ddsrt_mutex_unlock (&rd->e.lock);
|
||||
free_rd_pwr_match (m);
|
||||
|
||||
|
@ -1427,8 +1427,8 @@ static void reader_drop_local_connection (const struct nn_guid *rd_guid, const s
|
|||
{
|
||||
struct rd_wr_match *m;
|
||||
ddsrt_mutex_lock (&rd->e.lock);
|
||||
if ((m = ut_avlLookup (&rd_local_writers_treedef, &rd->local_writers, &wr->e.guid)) != NULL)
|
||||
ut_avlDelete (&rd_local_writers_treedef, &rd->local_writers, m);
|
||||
if ((m = ddsrt_avl_lookup (&rd_local_writers_treedef, &rd->local_writers, &wr->e.guid)) != NULL)
|
||||
ddsrt_avl_delete (&rd_local_writers_treedef, &rd->local_writers, m);
|
||||
ddsrt_mutex_unlock (&rd->e.lock);
|
||||
free_rd_wr_match (m);
|
||||
|
||||
|
@ -1486,9 +1486,9 @@ static void proxy_writer_drop_connection (const struct nn_guid *pwr_guid, struct
|
|||
struct pwr_rd_match *m;
|
||||
|
||||
ddsrt_mutex_lock (&pwr->e.lock);
|
||||
if ((m = ut_avlLookup (&pwr_readers_treedef, &pwr->readers, &rd->e.guid)) != NULL)
|
||||
if ((m = ddsrt_avl_lookup (&pwr_readers_treedef, &pwr->readers, &rd->e.guid)) != NULL)
|
||||
{
|
||||
ut_avlDelete (&pwr_readers_treedef, &pwr->readers, m);
|
||||
ddsrt_avl_delete (&pwr_readers_treedef, &pwr->readers, m);
|
||||
if (m->in_sync != PRMSS_SYNC)
|
||||
pwr->n_readers_out_of_sync--;
|
||||
if (rd->reliable)
|
||||
|
@ -1512,10 +1512,10 @@ static void proxy_reader_drop_connection
|
|||
{
|
||||
struct prd_wr_match *m;
|
||||
ddsrt_mutex_lock (&prd->e.lock);
|
||||
m = ut_avlLookup (&prd_writers_treedef, &prd->writers, &wr->e.guid);
|
||||
m = ddsrt_avl_lookup (&prd_writers_treedef, &prd->writers, &wr->e.guid);
|
||||
if (m)
|
||||
{
|
||||
ut_avlDelete (&prd_writers_treedef, &prd->writers, m);
|
||||
ddsrt_avl_delete (&prd_writers_treedef, &prd->writers, m);
|
||||
}
|
||||
ddsrt_mutex_unlock (&prd->e.lock);
|
||||
free_prd_wr_match (m);
|
||||
|
@ -1525,7 +1525,7 @@ static void proxy_reader_drop_connection
|
|||
static void writer_add_connection (struct writer *wr, struct proxy_reader *prd)
|
||||
{
|
||||
struct wr_prd_match *m = ddsrt_malloc (sizeof (*m));
|
||||
ut_avlIPath_t path;
|
||||
ddsrt_avl_ipath_t path;
|
||||
int pretend_everything_acked;
|
||||
m->prd_guid = prd->e.guid;
|
||||
m->is_reliable = (prd->c.xqos->reliability.kind > NN_BEST_EFFORT_RELIABILITY_QOS);
|
||||
|
@ -1564,7 +1564,7 @@ static void writer_add_connection (struct writer *wr, struct proxy_reader *prd)
|
|||
m->seq = MAX_SEQ_NUMBER;
|
||||
else
|
||||
m->seq = wr->seq;
|
||||
if (ut_avlLookupIPath (&wr_readers_treedef, &wr->readers, &prd->e.guid, &path))
|
||||
if (ddsrt_avl_lookup_ipath (&wr_readers_treedef, &wr->readers, &prd->e.guid, &path))
|
||||
{
|
||||
DDS_LOG(DDS_LC_DISCOVERY, " writer_add_connection(wr %x:%x:%x:%x prd %x:%x:%x:%x) - already connected\n", PGUID (wr->e.guid), PGUID (prd->e.guid));
|
||||
ddsrt_mutex_unlock (&wr->e.lock);
|
||||
|
@ -1574,7 +1574,7 @@ static void writer_add_connection (struct writer *wr, struct proxy_reader *prd)
|
|||
else
|
||||
{
|
||||
DDS_LOG(DDS_LC_DISCOVERY, " writer_add_connection(wr %x:%x:%x:%x prd %x:%x:%x:%x) - ack seq %"PRId64"\n", PGUID (wr->e.guid), PGUID (prd->e.guid), m->seq);
|
||||
ut_avlInsertIPath (&wr_readers_treedef, &wr->readers, m, &path);
|
||||
ddsrt_avl_insert_ipath (&wr_readers_treedef, &wr->readers, m, &path);
|
||||
rebuild_writer_addrset (wr);
|
||||
wr->num_reliable_readers += m->is_reliable;
|
||||
ddsrt_mutex_unlock (&wr->e.lock);
|
||||
|
@ -1618,10 +1618,10 @@ static void writer_add_connection (struct writer *wr, struct proxy_reader *prd)
|
|||
static void writer_add_local_connection (struct writer *wr, struct reader *rd)
|
||||
{
|
||||
struct wr_rd_match *m = ddsrt_malloc (sizeof (*m));
|
||||
ut_avlIPath_t path;
|
||||
ddsrt_avl_ipath_t path;
|
||||
|
||||
ddsrt_mutex_lock (&wr->e.lock);
|
||||
if (ut_avlLookupIPath (&wr_local_readers_treedef, &wr->local_readers, &rd->e.guid, &path))
|
||||
if (ddsrt_avl_lookup_ipath (&wr_local_readers_treedef, &wr->local_readers, &rd->e.guid, &path))
|
||||
{
|
||||
DDS_LOG(DDS_LC_DISCOVERY, " writer_add_local_connection(wr %x:%x:%x:%x rd %x:%x:%x:%x) - already connected\n", PGUID (wr->e.guid), PGUID (rd->e.guid));
|
||||
ddsrt_mutex_unlock (&wr->e.lock);
|
||||
|
@ -1631,7 +1631,7 @@ static void writer_add_local_connection (struct writer *wr, struct reader *rd)
|
|||
|
||||
DDS_LOG(DDS_LC_DISCOVERY, " writer_add_local_connection(wr %x:%x:%x:%x rd %x:%x:%x:%x)", PGUID (wr->e.guid), PGUID (rd->e.guid));
|
||||
m->rd_guid = rd->e.guid;
|
||||
ut_avlInsertIPath (&wr_local_readers_treedef, &wr->local_readers, m, &path);
|
||||
ddsrt_avl_insert_ipath (&wr_local_readers_treedef, &wr->local_readers, m, &path);
|
||||
local_reader_ary_insert (&wr->rdary, rd);
|
||||
|
||||
/* Store available data into the late joining reader when it is reliable (we don't do
|
||||
|
@ -1672,7 +1672,7 @@ static void writer_add_local_connection (struct writer *wr, struct reader *rd)
|
|||
static void reader_add_connection (struct reader *rd, struct proxy_writer *pwr, nn_count_t *init_count)
|
||||
{
|
||||
struct rd_pwr_match *m = ddsrt_malloc (sizeof (*m));
|
||||
ut_avlIPath_t path;
|
||||
ddsrt_avl_ipath_t path;
|
||||
|
||||
m->pwr_guid = pwr->e.guid;
|
||||
|
||||
|
@ -1687,7 +1687,7 @@ static void reader_add_connection (struct reader *rd, struct proxy_writer *pwr,
|
|||
DDS_LOG(DDS_LC_DISCOVERY, " reader %x:%x:%x:%x init_acknack_count = %d\n", PGUID (rd->e.guid), rd->init_acknack_count);
|
||||
*init_count = rd->init_acknack_count;
|
||||
|
||||
if (ut_avlLookupIPath (&rd_writers_treedef, &rd->writers, &pwr->e.guid, &path))
|
||||
if (ddsrt_avl_lookup_ipath (&rd_writers_treedef, &rd->writers, &pwr->e.guid, &path))
|
||||
{
|
||||
DDS_LOG(DDS_LC_DISCOVERY, " reader_add_connection(pwr %x:%x:%x:%x rd %x:%x:%x:%x) - already connected\n",
|
||||
PGUID (pwr->e.guid), PGUID (rd->e.guid));
|
||||
|
@ -1698,7 +1698,7 @@ static void reader_add_connection (struct reader *rd, struct proxy_writer *pwr,
|
|||
{
|
||||
DDS_LOG(DDS_LC_DISCOVERY, " reader_add_connection(pwr %x:%x:%x:%x rd %x:%x:%x:%x)\n",
|
||||
PGUID (pwr->e.guid), PGUID (rd->e.guid));
|
||||
ut_avlInsertIPath (&rd_writers_treedef, &rd->writers, m, &path);
|
||||
ddsrt_avl_insert_ipath (&rd_writers_treedef, &rd->writers, m, &path);
|
||||
ddsrt_mutex_unlock (&rd->e.lock);
|
||||
|
||||
#ifdef DDSI_INCLUDE_SSM
|
||||
|
@ -1736,13 +1736,13 @@ static void reader_add_connection (struct reader *rd, struct proxy_writer *pwr,
|
|||
static void reader_add_local_connection (struct reader *rd, struct writer *wr)
|
||||
{
|
||||
struct rd_wr_match *m = ddsrt_malloc (sizeof (*m));
|
||||
ut_avlIPath_t path;
|
||||
ddsrt_avl_ipath_t path;
|
||||
|
||||
m->wr_guid = wr->e.guid;
|
||||
|
||||
ddsrt_mutex_lock (&rd->e.lock);
|
||||
|
||||
if (ut_avlLookupIPath (&rd_local_writers_treedef, &rd->local_writers, &wr->e.guid, &path))
|
||||
if (ddsrt_avl_lookup_ipath (&rd_local_writers_treedef, &rd->local_writers, &wr->e.guid, &path))
|
||||
{
|
||||
DDS_LOG(DDS_LC_DISCOVERY, " reader_add_local_connection(wr %x:%x:%x:%x rd %x:%x:%x:%x) - already connected\n", PGUID (wr->e.guid), PGUID (rd->e.guid));
|
||||
ddsrt_mutex_unlock (&rd->e.lock);
|
||||
|
@ -1751,7 +1751,7 @@ static void reader_add_local_connection (struct reader *rd, struct writer *wr)
|
|||
else
|
||||
{
|
||||
DDS_LOG(DDS_LC_DISCOVERY, " reader_add_local_connection(wr %x:%x:%x:%x rd %x:%x:%x:%x)\n", PGUID (wr->e.guid), PGUID (rd->e.guid));
|
||||
ut_avlInsertIPath (&rd_local_writers_treedef, &rd->local_writers, m, &path);
|
||||
ddsrt_avl_insert_ipath (&rd_local_writers_treedef, &rd->local_writers, m, &path);
|
||||
ddsrt_mutex_unlock (&rd->e.lock);
|
||||
|
||||
if (rd->status_cb)
|
||||
|
@ -1772,11 +1772,11 @@ static void reader_add_local_connection (struct reader *rd, struct writer *wr)
|
|||
static void proxy_writer_add_connection (struct proxy_writer *pwr, struct reader *rd, nn_mtime_t tnow, nn_count_t init_count)
|
||||
{
|
||||
struct pwr_rd_match *m = ddsrt_malloc (sizeof (*m));
|
||||
ut_avlIPath_t path;
|
||||
ddsrt_avl_ipath_t path;
|
||||
seqno_t last_deliv_seq;
|
||||
|
||||
ddsrt_mutex_lock (&pwr->e.lock);
|
||||
if (ut_avlLookupIPath (&pwr_readers_treedef, &pwr->readers, &rd->e.guid, &path))
|
||||
if (ddsrt_avl_lookup_ipath (&pwr_readers_treedef, &pwr->readers, &rd->e.guid, &path))
|
||||
goto already_matched;
|
||||
|
||||
if (pwr->c.topic == NULL && rd->topic)
|
||||
|
@ -1816,7 +1816,7 @@ static void proxy_writer_add_connection (struct proxy_writer *pwr, struct reader
|
|||
{
|
||||
m->in_sync = PRMSS_SYNC;
|
||||
}
|
||||
else if (!config.conservative_builtin_reader_startup && is_builtin_entityid (rd->e.guid.entityid, NN_VENDORID_ECLIPSE) && !ut_avlIsEmpty (&pwr->readers))
|
||||
else if (!config.conservative_builtin_reader_startup && is_builtin_entityid (rd->e.guid.entityid, NN_VENDORID_ECLIPSE) && !ddsrt_avl_is_empty (&pwr->readers))
|
||||
{
|
||||
/* builtins really don't care about multiple copies */
|
||||
m->in_sync = PRMSS_SYNC;
|
||||
|
@ -1860,7 +1860,7 @@ static void proxy_writer_add_connection (struct proxy_writer *pwr, struct reader
|
|||
nn_reorder_new (NN_REORDER_MODE_MONOTONICALLY_INCREASING, config.secondary_reorder_maxsamples);
|
||||
}
|
||||
|
||||
ut_avlInsertIPath (&pwr_readers_treedef, &pwr->readers, m, &path);
|
||||
ddsrt_avl_insert_ipath (&pwr_readers_treedef, &pwr->readers, m, &path);
|
||||
local_reader_ary_insert(&pwr->rdary, rd);
|
||||
ddsrt_mutex_unlock (&pwr->e.lock);
|
||||
qxev_pwr_entityid (pwr, &rd->e.guid.prefix);
|
||||
|
@ -1890,13 +1890,13 @@ already_matched:
|
|||
static void proxy_reader_add_connection (struct proxy_reader *prd, struct writer *wr)
|
||||
{
|
||||
struct prd_wr_match *m = ddsrt_malloc (sizeof (*m));
|
||||
ut_avlIPath_t path;
|
||||
ddsrt_avl_ipath_t path;
|
||||
|
||||
m->wr_guid = wr->e.guid;
|
||||
ddsrt_mutex_lock (&prd->e.lock);
|
||||
if (prd->c.topic == NULL)
|
||||
prd->c.topic = ddsi_sertopic_ref (wr->topic);
|
||||
if (ut_avlLookupIPath (&prd_writers_treedef, &prd->writers, &wr->e.guid, &path))
|
||||
if (ddsrt_avl_lookup_ipath (&prd_writers_treedef, &prd->writers, &wr->e.guid, &path))
|
||||
{
|
||||
DDS_LOG(DDS_LC_DISCOVERY, " proxy_reader_add_connection(wr %x:%x:%x:%x prd %x:%x:%x:%x) - already connected\n",
|
||||
PGUID (wr->e.guid), PGUID (prd->e.guid));
|
||||
|
@ -1907,7 +1907,7 @@ static void proxy_reader_add_connection (struct proxy_reader *prd, struct writer
|
|||
{
|
||||
DDS_LOG(DDS_LC_DISCOVERY, " proxy_reader_add_connection(wr %x:%x:%x:%x prd %x:%x:%x:%x)\n",
|
||||
PGUID (wr->e.guid), PGUID (prd->e.guid));
|
||||
ut_avlInsertIPath (&prd_writers_treedef, &prd->writers, m, &path);
|
||||
ddsrt_avl_insert_ipath (&prd_writers_treedef, &prd->writers, m, &path);
|
||||
ddsrt_mutex_unlock (&prd->e.lock);
|
||||
qxev_prd_entityid (prd, &wr->e.guid.prefix);
|
||||
}
|
||||
|
@ -2539,15 +2539,15 @@ static void augment_wr_prd_match (void *vnode, const void *vleft, const void *vr
|
|||
seqno_t writer_max_drop_seq (const struct writer *wr)
|
||||
{
|
||||
const struct wr_prd_match *n;
|
||||
if (ut_avlIsEmpty (&wr->readers))
|
||||
if (ddsrt_avl_is_empty (&wr->readers))
|
||||
return wr->seq;
|
||||
n = ut_avlRootNonEmpty (&wr_readers_treedef, &wr->readers);
|
||||
n = ddsrt_avl_root_non_empty (&wr_readers_treedef, &wr->readers);
|
||||
return (n->min_seq == MAX_SEQ_NUMBER) ? wr->seq : n->min_seq;
|
||||
}
|
||||
|
||||
int writer_must_have_hb_scheduled (const struct writer *wr, const struct whc_state *whcst)
|
||||
{
|
||||
if (ut_avlIsEmpty (&wr->readers) || whcst->max_seq < 0)
|
||||
if (ddsrt_avl_is_empty (&wr->readers) || whcst->max_seq < 0)
|
||||
{
|
||||
/* Can't transmit a valid heartbeat if there is no data; and it
|
||||
wouldn't actually be sent anywhere if there are no readers, so
|
||||
|
@ -2558,7 +2558,7 @@ int writer_must_have_hb_scheduled (const struct writer *wr, const struct whc_sta
|
|||
a heartbeat if no data is available. */
|
||||
return 0;
|
||||
}
|
||||
else if (!((const struct wr_prd_match *) ut_avlRootNonEmpty (&wr_readers_treedef, &wr->readers))->all_have_replied_to_hb)
|
||||
else if (!((const struct wr_prd_match *) ddsrt_avl_root_non_empty (&wr_readers_treedef, &wr->readers))->all_have_replied_to_hb)
|
||||
{
|
||||
/* Labouring under the belief that heartbeats must be sent
|
||||
regardless of ack state */
|
||||
|
@ -2800,8 +2800,8 @@ static void new_writer_guid_common_init (struct writer *wr, const struct ddsi_se
|
|||
assert (!is_builtin_entityid(wr->e.guid.entityid, NN_VENDORID_ECLIPSE) || (wr->whc_low == wr->whc_high && wr->whc_low == INT32_MAX));
|
||||
|
||||
/* Connection admin */
|
||||
ut_avlInit (&wr_readers_treedef, &wr->readers);
|
||||
ut_avlInit (&wr_local_readers_treedef, &wr->local_readers);
|
||||
ddsrt_avl_init (&wr_readers_treedef, &wr->readers);
|
||||
ddsrt_avl_init (&wr_local_readers_treedef, &wr->local_readers);
|
||||
|
||||
local_reader_ary_init (&wr->rdary);
|
||||
}
|
||||
|
@ -2917,17 +2917,17 @@ static void gc_delete_writer (struct gcreq *gcreq)
|
|||
us now, because we can't be found via guid_hash anymore. We
|
||||
therefore need not take lock. */
|
||||
|
||||
while (!ut_avlIsEmpty (&wr->readers))
|
||||
while (!ddsrt_avl_is_empty (&wr->readers))
|
||||
{
|
||||
struct wr_prd_match *m = ut_avlRootNonEmpty (&wr_readers_treedef, &wr->readers);
|
||||
ut_avlDelete (&wr_readers_treedef, &wr->readers, m);
|
||||
struct wr_prd_match *m = ddsrt_avl_root_non_empty (&wr_readers_treedef, &wr->readers);
|
||||
ddsrt_avl_delete (&wr_readers_treedef, &wr->readers, m);
|
||||
proxy_reader_drop_connection (&m->prd_guid, wr);
|
||||
free_wr_prd_match (m);
|
||||
}
|
||||
while (!ut_avlIsEmpty (&wr->local_readers))
|
||||
while (!ddsrt_avl_is_empty (&wr->local_readers))
|
||||
{
|
||||
struct wr_rd_match *m = ut_avlRootNonEmpty (&wr_local_readers_treedef, &wr->local_readers);
|
||||
ut_avlDelete (&wr_local_readers_treedef, &wr->local_readers, m);
|
||||
struct wr_rd_match *m = ddsrt_avl_root_non_empty (&wr_local_readers_treedef, &wr->local_readers);
|
||||
ddsrt_avl_delete (&wr_local_readers_treedef, &wr->local_readers, m);
|
||||
reader_drop_local_connection (&m->rd_guid, wr);
|
||||
free_wr_rd_match (m);
|
||||
}
|
||||
|
@ -3324,8 +3324,8 @@ static dds_retcode_t new_reader_guid
|
|||
#endif
|
||||
#endif
|
||||
|
||||
ut_avlInit (&rd_writers_treedef, &rd->writers);
|
||||
ut_avlInit (&rd_local_writers_treedef, &rd->local_writers);
|
||||
ddsrt_avl_init (&rd_writers_treedef, &rd->writers);
|
||||
ddsrt_avl_init (&rd_local_writers_treedef, &rd->local_writers);
|
||||
|
||||
ddsrt_mutex_lock (&rd->e.lock);
|
||||
ephash_insert_reader_guid (rd);
|
||||
|
@ -3371,17 +3371,17 @@ static void gc_delete_reader (struct gcreq *gcreq)
|
|||
DDS_LOG(DDS_LC_DISCOVERY, "gc_delete_reader(%p, %x:%x:%x:%x)\n", (void *) gcreq, PGUID (rd->e.guid));
|
||||
gcreq_free (gcreq);
|
||||
|
||||
while (!ut_avlIsEmpty (&rd->writers))
|
||||
while (!ddsrt_avl_is_empty (&rd->writers))
|
||||
{
|
||||
struct rd_pwr_match *m = ut_avlRootNonEmpty (&rd_writers_treedef, &rd->writers);
|
||||
ut_avlDelete (&rd_writers_treedef, &rd->writers, m);
|
||||
struct rd_pwr_match *m = ddsrt_avl_root_non_empty (&rd_writers_treedef, &rd->writers);
|
||||
ddsrt_avl_delete (&rd_writers_treedef, &rd->writers, m);
|
||||
proxy_writer_drop_connection (&m->pwr_guid, rd);
|
||||
free_rd_pwr_match (m);
|
||||
}
|
||||
while (!ut_avlIsEmpty (&rd->local_writers))
|
||||
while (!ddsrt_avl_is_empty (&rd->local_writers))
|
||||
{
|
||||
struct rd_wr_match *m = ut_avlRootNonEmpty (&rd_local_writers_treedef, &rd->local_writers);
|
||||
ut_avlDelete (&rd_local_writers_treedef, &rd->local_writers, m);
|
||||
struct rd_wr_match *m = ddsrt_avl_root_non_empty (&rd_local_writers_treedef, &rd->local_writers);
|
||||
ddsrt_avl_delete (&rd_local_writers_treedef, &rd->local_writers, m);
|
||||
writer_drop_local_connection (&m->wr_guid, rd);
|
||||
free_rd_wr_match (m);
|
||||
}
|
||||
|
@ -3552,7 +3552,7 @@ void new_proxy_participant
|
|||
proxypp->as_meta = as_meta;
|
||||
proxypp->endpoints = NULL;
|
||||
proxypp->plist = nn_plist_dup (plist);
|
||||
ut_avlInit (&proxypp_groups_treedef, &proxypp->groups);
|
||||
ddsrt_avl_init (&proxypp_groups_treedef, &proxypp->groups);
|
||||
|
||||
|
||||
if (custom_flags & CF_INC_KERNEL_SEQUENCE_NUMBERS)
|
||||
|
@ -3851,8 +3851,8 @@ static void delete_ppt (struct proxy_participant * proxypp, nn_wctime_t timestam
|
|||
proxypp->lease_expired = 1;
|
||||
|
||||
DDS_LOG(DDS_LC_DISCOVERY, "delete_ppt(%x:%x:%x:%x) - deleting groups\n", PGUID (proxypp->e.guid));
|
||||
while (!ut_avlIsEmpty (&proxypp->groups))
|
||||
delete_proxy_group_locked (ut_avlRoot (&proxypp_groups_treedef, &proxypp->groups), timestamp, isimplicit);
|
||||
while (!ddsrt_avl_is_empty (&proxypp->groups))
|
||||
delete_proxy_group_locked (ddsrt_avl_root (&proxypp_groups_treedef, &proxypp->groups), timestamp, isimplicit);
|
||||
|
||||
DDS_LOG(DDS_LC_DISCOVERY, "delete_ppt(%x:%x:%x:%x) - deleting endpoints\n", PGUID (proxypp->e.guid));
|
||||
c = proxypp->endpoints;
|
||||
|
@ -3965,7 +3965,7 @@ int new_proxy_group (const struct nn_guid *guid, const char *name, const struct
|
|||
else
|
||||
{
|
||||
struct proxy_group *pgroup;
|
||||
ut_avlIPath_t ipath;
|
||||
ddsrt_avl_ipath_t ipath;
|
||||
int is_sub;
|
||||
switch (guid->entityid.u & (NN_ENTITYID_SOURCE_MASK | NN_ENTITYID_KIND_MASK))
|
||||
{
|
||||
|
@ -3980,7 +3980,7 @@ int new_proxy_group (const struct nn_guid *guid, const char *name, const struct
|
|||
return Q_ERR_INVALID_DATA;
|
||||
}
|
||||
ddsrt_mutex_lock (&proxypp->e.lock);
|
||||
if ((pgroup = ut_avlLookupIPath (&proxypp_groups_treedef, &proxypp->groups, guid, &ipath)) != NULL)
|
||||
if ((pgroup = ddsrt_avl_lookup_ipath (&proxypp_groups_treedef, &proxypp->groups, guid, &ipath)) != NULL)
|
||||
{
|
||||
/* Complete proxy group definition if it was a partial
|
||||
definition made by creating a proxy reader or writer,
|
||||
|
@ -3997,7 +3997,7 @@ int new_proxy_group (const struct nn_guid *guid, const char *name, const struct
|
|||
pgroup->proxypp = proxypp;
|
||||
pgroup->name = NULL;
|
||||
pgroup->xqos = NULL;
|
||||
ut_avlInsertIPath (&proxypp_groups_treedef, &proxypp->groups, pgroup, &ipath);
|
||||
ddsrt_avl_insert_ipath (&proxypp_groups_treedef, &proxypp->groups, pgroup, &ipath);
|
||||
}
|
||||
if (name)
|
||||
{
|
||||
|
@ -4021,7 +4021,7 @@ static void delete_proxy_group_locked (struct proxy_group *pgroup, nn_wctime_t t
|
|||
(void)isimplicit;
|
||||
assert ((pgroup->xqos != NULL) == (pgroup->name != NULL));
|
||||
DDS_LOG(DDS_LC_DISCOVERY, "delete_proxy_group_locked %x:%x:%x:%x\n", PGUID (pgroup->guid));
|
||||
ut_avlDelete (&proxypp_groups_treedef, &proxypp->groups, pgroup);
|
||||
ddsrt_avl_delete (&proxypp_groups_treedef, &proxypp->groups, pgroup);
|
||||
/* Publish corresponding built-in topic only if it is not a place
|
||||
holder: in that case we haven't announced its presence and
|
||||
therefore don't need to dispose it, and this saves us from having
|
||||
|
@ -4046,7 +4046,7 @@ void delete_proxy_group (const nn_guid_t *guid, nn_wctime_t timestamp, int isimp
|
|||
{
|
||||
struct proxy_group *pgroup;
|
||||
ddsrt_mutex_lock (&proxypp->e.lock);
|
||||
if ((pgroup = ut_avlLookup (&proxypp_groups_treedef, &proxypp->groups, guid)) != NULL)
|
||||
if ((pgroup = ddsrt_avl_lookup (&proxypp_groups_treedef, &proxypp->groups, guid)) != NULL)
|
||||
delete_proxy_group_locked (pgroup, timestamp, isimplicit);
|
||||
ddsrt_mutex_unlock (&proxypp->e.lock);
|
||||
}
|
||||
|
@ -4112,7 +4112,7 @@ int new_proxy_writer (const struct nn_guid *ppguid, const struct nn_guid *guid,
|
|||
pwr = ddsrt_malloc (sizeof (*pwr));
|
||||
proxy_endpoint_common_init (&pwr->e, &pwr->c, EK_PROXY_WRITER, guid, timestamp, proxypp, as, plist);
|
||||
|
||||
ut_avlInit (&pwr_readers_treedef, &pwr->readers);
|
||||
ddsrt_avl_init (&pwr_readers_treedef, &pwr->readers);
|
||||
pwr->n_reliable_readers = 0;
|
||||
pwr->n_readers_out_of_sync = 0;
|
||||
pwr->last_seq = 0;
|
||||
|
@ -4195,7 +4195,7 @@ void update_proxy_writer (struct proxy_writer * pwr, struct addrset * as)
|
|||
{
|
||||
struct reader * rd;
|
||||
struct pwr_rd_match * m;
|
||||
ut_avlIter_t iter;
|
||||
ddsrt_avl_iter_t iter;
|
||||
|
||||
/* Update proxy writer endpoints (from SEDP alive) */
|
||||
|
||||
|
@ -4208,7 +4208,7 @@ void update_proxy_writer (struct proxy_writer * pwr, struct addrset * as)
|
|||
unref_addrset (pwr->c.as);
|
||||
ref_addrset (as);
|
||||
pwr->c.as = as;
|
||||
m = ut_avlIterFirst (&pwr_readers_treedef, &pwr->readers, &iter);
|
||||
m = ddsrt_avl_iter_first (&pwr_readers_treedef, &pwr->readers, &iter);
|
||||
while (m)
|
||||
{
|
||||
rd = ephash_lookup_reader_guid (&m->rd_guid);
|
||||
|
@ -4216,7 +4216,7 @@ void update_proxy_writer (struct proxy_writer * pwr, struct addrset * as)
|
|||
{
|
||||
qxev_pwr_entityid (pwr, &rd->e.guid.prefix);
|
||||
}
|
||||
m = ut_avlIterNext (&iter);
|
||||
m = ddsrt_avl_iter_next (&iter);
|
||||
}
|
||||
}
|
||||
ddsrt_mutex_unlock (&pwr->e.lock);
|
||||
|
@ -4240,14 +4240,14 @@ void update_proxy_reader (struct proxy_reader * prd, struct addrset * as)
|
|||
|
||||
/* Rebuild writer endpoints */
|
||||
|
||||
while ((m = ut_avlLookupSuccEq (&prd_writers_treedef, &prd->writers, &wrguid)) != NULL)
|
||||
while ((m = ddsrt_avl_lookup_succ_eq (&prd_writers_treedef, &prd->writers, &wrguid)) != NULL)
|
||||
{
|
||||
struct prd_wr_match *next;
|
||||
nn_guid_t guid_next;
|
||||
struct writer * wr;
|
||||
|
||||
wrguid = m->wr_guid;
|
||||
next = ut_avlFindSucc (&prd_writers_treedef, &prd->writers, m);
|
||||
next = ddsrt_avl_find_succ (&prd_writers_treedef, &prd->writers, m);
|
||||
if (next)
|
||||
{
|
||||
guid_next = next->wr_guid;
|
||||
|
@ -4280,10 +4280,10 @@ static void gc_delete_proxy_writer (struct gcreq *gcreq)
|
|||
DDS_LOG(DDS_LC_DISCOVERY, "gc_delete_proxy_writer(%p, %x:%x:%x:%x)\n", (void *) gcreq, PGUID (pwr->e.guid));
|
||||
gcreq_free (gcreq);
|
||||
|
||||
while (!ut_avlIsEmpty (&pwr->readers))
|
||||
while (!ddsrt_avl_is_empty (&pwr->readers))
|
||||
{
|
||||
struct pwr_rd_match *m = ut_avlRootNonEmpty (&pwr_readers_treedef, &pwr->readers);
|
||||
ut_avlDelete (&pwr_readers_treedef, &pwr->readers, m);
|
||||
struct pwr_rd_match *m = ddsrt_avl_root_non_empty (&pwr_readers_treedef, &pwr->readers);
|
||||
ddsrt_avl_delete (&pwr_readers_treedef, &pwr->readers, m);
|
||||
reader_drop_connection (&m->rd_guid, pwr);
|
||||
update_reader_init_acknack_count (&m->rd_guid, m->count);
|
||||
free_pwr_rd_match (m);
|
||||
|
@ -4353,7 +4353,7 @@ int new_proxy_reader (const struct nn_guid *ppguid, const struct nn_guid *guid,
|
|||
"real" participant, rather than the thing we use for endpoints discovered via the DS */
|
||||
prd->assert_pp_lease = (unsigned) !!config.arrival_of_data_asserts_pp_and_ep_liveliness;
|
||||
|
||||
ut_avlInit (&prd_writers_treedef, &prd->writers);
|
||||
ddsrt_avl_init (&prd_writers_treedef, &prd->writers);
|
||||
|
||||
/* locking the entity prevents matching while the built-in topic hasn't been published yet */
|
||||
ddsrt_mutex_lock (&prd->e.lock);
|
||||
|
@ -4374,14 +4374,14 @@ static void proxy_reader_set_delete_and_ack_all_messages (struct proxy_reader *p
|
|||
memset (&wrguid, 0, sizeof (wrguid));
|
||||
ddsrt_mutex_lock (&prd->e.lock);
|
||||
prd->deleting = 1;
|
||||
while ((m = ut_avlLookupSuccEq (&prd_writers_treedef, &prd->writers, &wrguid)) != NULL)
|
||||
while ((m = ddsrt_avl_lookup_succ_eq (&prd_writers_treedef, &prd->writers, &wrguid)) != NULL)
|
||||
{
|
||||
/* have to be careful walking the tree -- pretty is different, but
|
||||
I want to check this before I write a lookup_succ function. */
|
||||
struct prd_wr_match *m_a_next;
|
||||
nn_guid_t wrguid_next;
|
||||
wrguid = m->wr_guid;
|
||||
if ((m_a_next = ut_avlFindSucc (&prd_writers_treedef, &prd->writers, m)) != NULL)
|
||||
if ((m_a_next = ddsrt_avl_find_succ (&prd_writers_treedef, &prd->writers, m)) != NULL)
|
||||
wrguid_next = m_a_next->wr_guid;
|
||||
else
|
||||
{
|
||||
|
@ -4395,11 +4395,11 @@ static void proxy_reader_set_delete_and_ack_all_messages (struct proxy_reader *p
|
|||
struct whc_node *deferred_free_list = NULL;
|
||||
struct wr_prd_match *m_wr;
|
||||
ddsrt_mutex_lock (&wr->e.lock);
|
||||
if ((m_wr = ut_avlLookup (&wr_readers_treedef, &wr->readers, &prd->e.guid)) != NULL)
|
||||
if ((m_wr = ddsrt_avl_lookup (&wr_readers_treedef, &wr->readers, &prd->e.guid)) != NULL)
|
||||
{
|
||||
struct whc_state whcst;
|
||||
m_wr->seq = MAX_SEQ_NUMBER;
|
||||
ut_avlAugmentUpdate (&wr_readers_treedef, m_wr);
|
||||
ddsrt_avl_augment_update (&wr_readers_treedef, m_wr);
|
||||
(void)remove_acked_messages (wr, &whcst, &deferred_free_list);
|
||||
writer_clear_retransmitting (wr);
|
||||
}
|
||||
|
@ -4419,10 +4419,10 @@ static void gc_delete_proxy_reader (struct gcreq *gcreq)
|
|||
DDS_LOG(DDS_LC_DISCOVERY, "gc_delete_proxy_reader(%p, %x:%x:%x:%x)\n", (void *) gcreq, PGUID (prd->e.guid));
|
||||
gcreq_free (gcreq);
|
||||
|
||||
while (!ut_avlIsEmpty (&prd->writers))
|
||||
while (!ddsrt_avl_is_empty (&prd->writers))
|
||||
{
|
||||
struct prd_wr_match *m = ut_avlRootNonEmpty (&prd_writers_treedef, &prd->writers);
|
||||
ut_avlDelete (&prd_writers_treedef, &prd->writers, m);
|
||||
struct prd_wr_match *m = ddsrt_avl_root_non_empty (&prd_writers_treedef, &prd->writers);
|
||||
ddsrt_avl_delete (&prd_writers_treedef, &prd->writers, m);
|
||||
writer_drop_connection (&m->wr_guid, prd);
|
||||
free_prd_wr_match (m);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "dds/ddsrt/heap.h"
|
||||
#include "dds/ddsrt/misc.h"
|
||||
|
||||
#include "dds/util/ut_hopscotch.h"
|
||||
#include "dds/ddsrt/hopscotch.h"
|
||||
#include "dds/ddsi/q_ephash.h"
|
||||
#include "dds/ddsi/q_config.h"
|
||||
#include "dds/ddsi/q_globals.h"
|
||||
|
@ -25,7 +25,7 @@
|
|||
#include "dds/ddsi/q_thread.h" /* for assert(thread is awake) */
|
||||
|
||||
struct ephash {
|
||||
struct ut_chh *hash;
|
||||
struct ddsrt_chh *hash;
|
||||
};
|
||||
|
||||
static const uint64_t unihashconsts[] = {
|
||||
|
@ -80,7 +80,7 @@ struct ephash *ephash_new (void)
|
|||
{
|
||||
struct ephash *ephash;
|
||||
ephash = ddsrt_malloc (sizeof (*ephash));
|
||||
ephash->hash = ut_chhNew (32, hash_entity_guid_wrapper, entity_guid_eq_wrapper, gc_buckets);
|
||||
ephash->hash = ddsrt_chh_new (32, hash_entity_guid_wrapper, entity_guid_eq_wrapper, gc_buckets);
|
||||
if (ephash->hash == NULL) {
|
||||
ddsrt_free (ephash);
|
||||
return NULL;
|
||||
|
@ -91,7 +91,7 @@ struct ephash *ephash_new (void)
|
|||
|
||||
void ephash_free (struct ephash *ephash)
|
||||
{
|
||||
ut_chhFree (ephash->hash);
|
||||
ddsrt_chh_free (ephash->hash);
|
||||
ephash->hash = NULL;
|
||||
ddsrt_free (ephash);
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ static void ephash_guid_insert (struct entity_common *e)
|
|||
int x;
|
||||
assert(gv.guid_hash);
|
||||
assert(gv.guid_hash->hash);
|
||||
x = ut_chhAdd (gv.guid_hash->hash, e);
|
||||
x = ddsrt_chh_add (gv.guid_hash->hash, e);
|
||||
(void)x;
|
||||
assert (x);
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ static void ephash_guid_remove (struct entity_common *e)
|
|||
int x;
|
||||
assert(gv.guid_hash);
|
||||
assert(gv.guid_hash->hash);
|
||||
x = ut_chhRemove (gv.guid_hash->hash, e);
|
||||
x = ddsrt_chh_remove (gv.guid_hash->hash, e);
|
||||
(void)x;
|
||||
assert (x);
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ void *ephash_lookup_guid_untyped (const struct nn_guid *guid)
|
|||
/* FIXME: could (now) require guid to be first in entity_common; entity_common already is first in entity */
|
||||
struct entity_common e;
|
||||
e.guid = *guid;
|
||||
return ut_chhLookup (gv.guid_hash->hash, &e);
|
||||
return ddsrt_chh_lookup (gv.guid_hash->hash, &e);
|
||||
}
|
||||
|
||||
static void *ephash_lookup_guid_int (const struct ephash *ephash, const struct nn_guid *guid, enum entity_kind kind)
|
||||
|
@ -246,9 +246,9 @@ struct proxy_reader *ephash_lookup_proxy_reader_guid (const struct nn_guid *guid
|
|||
static void ephash_enum_init_int (struct ephash_enum *st, struct ephash *ephash, enum entity_kind kind)
|
||||
{
|
||||
st->kind = kind;
|
||||
st->cur = ut_chhIterFirst (ephash->hash, &st->it);
|
||||
st->cur = ddsrt_chh_iter_first (ephash->hash, &st->it);
|
||||
while (st->cur && st->cur->kind != st->kind)
|
||||
st->cur = ut_chhIterNext (&st->it);
|
||||
st->cur = ddsrt_chh_iter_next (&st->it);
|
||||
}
|
||||
|
||||
void ephash_enum_init (struct ephash_enum *st, enum entity_kind kind)
|
||||
|
@ -291,9 +291,9 @@ void *ephash_enum_next (struct ephash_enum *st)
|
|||
void *res = st->cur;
|
||||
if (st->cur)
|
||||
{
|
||||
st->cur = ut_chhIterNext (&st->it);
|
||||
st->cur = ddsrt_chh_iter_next (&st->it);
|
||||
while (st->cur && st->cur->kind != st->kind)
|
||||
st->cur = ut_chhIterNext (&st->it);
|
||||
st->cur = ddsrt_chh_iter_next (&st->it);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
#include "dds/ddsrt/string.h"
|
||||
#include "dds/ddsrt/sync.h"
|
||||
|
||||
#include "dds/util/ut_avl.h"
|
||||
#include "dds/util/ut_thread_pool.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
#include "dds/ddsrt/thread_pool.h"
|
||||
|
||||
#include "dds/ddsi/q_protocol.h"
|
||||
#include "dds/ddsi/q_rtps.h"
|
||||
|
@ -895,7 +895,7 @@ int rtps_init (void)
|
|||
|
||||
if (config.tp_enable)
|
||||
{
|
||||
gv.thread_pool = ut_thread_pool_new
|
||||
gv.thread_pool = ddsrt_thread_pool_new
|
||||
(config.tp_threads, config.tp_max_threads, 0, NULL);
|
||||
}
|
||||
|
||||
|
@ -1357,7 +1357,7 @@ err_find_own_ip:
|
|||
ddsi_tran_factories_fini ();
|
||||
err_udp_tcp_init:
|
||||
if (config.tp_enable)
|
||||
ut_thread_pool_free (gv.thread_pool);
|
||||
ddsrt_thread_pool_free (gv.thread_pool);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1609,7 +1609,7 @@ void rtps_fini (void)
|
|||
}
|
||||
#endif
|
||||
|
||||
ut_thread_pool_free (gv.thread_pool);
|
||||
ddsrt_thread_pool_free (gv.thread_pool);
|
||||
|
||||
(void) joinleave_spdp_defmcip (0);
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@
|
|||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include "dds/ddsrt/heap.h"
|
||||
#include "dds/util/ut_avl.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
#include "dds/ddsi/q_config.h"
|
||||
#include "dds/ddsi/q_log.h"
|
||||
#include "dds/ddsi/q_inverse_uint32_set.h"
|
||||
|
||||
static int uint32_t_cmp(const void *va, const void *vb);
|
||||
|
||||
static ut_avlTreedef_t inverse_uint32_set_td = UT_AVL_TREEDEF_INITIALIZER(offsetof(struct inverse_uint32_set_node, avlnode), offsetof(struct inverse_uint32_set_node, min), uint32_t_cmp, 0);
|
||||
static ddsrt_avl_treedef_t inverse_uint32_set_td = DDSRT_AVL_TREEDEF_INITIALIZER(offsetof(struct inverse_uint32_set_node, avlnode), offsetof(struct inverse_uint32_set_node, min), uint32_t_cmp, 0);
|
||||
|
||||
static int uint32_t_cmp(const void *va, const void *vb)
|
||||
{
|
||||
|
@ -31,12 +31,12 @@ static int uint32_t_cmp(const void *va, const void *vb)
|
|||
static void check(const struct inverse_uint32_set *set)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
ut_avlIter_t it;
|
||||
ddsrt_avl_iter_t it;
|
||||
struct inverse_uint32_set_node *pn = NULL, *n;
|
||||
assert(set->min <= set->max);
|
||||
assert(set->cursor >= set->min);
|
||||
assert(set->cursor <= set->max);
|
||||
for (n = ut_avlIterFirst(&inverse_uint32_set_td, &set->ids, &it); n; pn = n, n = ut_avlIterNext(&it))
|
||||
for (n = ddsrt_avl_iter_first(&inverse_uint32_set_td, &set->ids, &it); n; pn = n, n = ddsrt_avl_iter_next(&it))
|
||||
{
|
||||
assert(n->min <= n->max);
|
||||
assert(n->min >= set->min);
|
||||
|
@ -51,20 +51,20 @@ static void check(const struct inverse_uint32_set *set)
|
|||
void inverse_uint32_set_init(struct inverse_uint32_set *set, uint32_t min, uint32_t max)
|
||||
{
|
||||
struct inverse_uint32_set_node *n;
|
||||
ut_avlInit(&inverse_uint32_set_td, &set->ids);
|
||||
ddsrt_avl_init(&inverse_uint32_set_td, &set->ids);
|
||||
set->cursor = min;
|
||||
set->min = min;
|
||||
set->max = max;
|
||||
n = ddsrt_malloc(sizeof(*n));
|
||||
n->min = min;
|
||||
n->max = max;
|
||||
ut_avlInsert(&inverse_uint32_set_td, &set->ids, n);
|
||||
ddsrt_avl_insert(&inverse_uint32_set_td, &set->ids, n);
|
||||
check(set);
|
||||
}
|
||||
|
||||
void inverse_uint32_set_fini(struct inverse_uint32_set *set)
|
||||
{
|
||||
ut_avlFree(&inverse_uint32_set_td, &set->ids, ddsrt_free);
|
||||
ddsrt_avl_free(&inverse_uint32_set_td, &set->ids, ddsrt_free);
|
||||
}
|
||||
|
||||
static uint32_t inverse_uint32_set_alloc_use_min(struct inverse_uint32_set *set, struct inverse_uint32_set_node *n)
|
||||
|
@ -72,7 +72,7 @@ static uint32_t inverse_uint32_set_alloc_use_min(struct inverse_uint32_set *set,
|
|||
const uint32_t id = n->min;
|
||||
if (n->min == n->max)
|
||||
{
|
||||
ut_avlDelete(&inverse_uint32_set_td, &set->ids, n);
|
||||
ddsrt_avl_delete(&inverse_uint32_set_td, &set->ids, n);
|
||||
ddsrt_free(n);
|
||||
}
|
||||
else
|
||||
|
@ -86,7 +86,7 @@ static uint32_t inverse_uint32_set_alloc_use_min(struct inverse_uint32_set *set,
|
|||
int inverse_uint32_set_alloc(uint32_t * const id, struct inverse_uint32_set *set)
|
||||
{
|
||||
struct inverse_uint32_set_node *n;
|
||||
if ((n = ut_avlLookupPredEq(&inverse_uint32_set_td, &set->ids, &set->cursor)) != NULL && set->cursor <= n->max) {
|
||||
if ((n = ddsrt_avl_lookup_pred_eq(&inverse_uint32_set_td, &set->ids, &set->cursor)) != NULL && set->cursor <= n->max) {
|
||||
/* n is [a,b] s.t. a <= C <= b, so C is available */
|
||||
*id = set->cursor;
|
||||
if (n->min == set->cursor)
|
||||
|
@ -105,15 +105,15 @@ int inverse_uint32_set_alloc(uint32_t * const id, struct inverse_uint32_set *set
|
|||
n1->min = set->cursor + 1;
|
||||
n1->max = n->max;
|
||||
n->max = set->cursor - 1;
|
||||
ut_avlInsert(&inverse_uint32_set_td, &set->ids, n1);
|
||||
ddsrt_avl_insert(&inverse_uint32_set_td, &set->ids, n1);
|
||||
}
|
||||
}
|
||||
else if ((n = ut_avlLookupSucc(&inverse_uint32_set_td, &set->ids, &set->cursor)) != NULL)
|
||||
else if ((n = ddsrt_avl_lookup_succ(&inverse_uint32_set_td, &set->ids, &set->cursor)) != NULL)
|
||||
{
|
||||
/* n is [a,b] s.t. a > C and all intervals [a',b'] in tree have a' <= C */
|
||||
*id = inverse_uint32_set_alloc_use_min(set, n);
|
||||
}
|
||||
else if ((n = ut_avlFindMin(&inverse_uint32_set_td, &set->ids)) != NULL)
|
||||
else if ((n = ddsrt_avl_find_min(&inverse_uint32_set_td, &set->ids)) != NULL)
|
||||
{
|
||||
/* no available ids >= cursor: wrap around and use the first available */
|
||||
assert(n->max < set->cursor);
|
||||
|
@ -133,8 +133,8 @@ void inverse_uint32_set_free(struct inverse_uint32_set *set, uint32_t id)
|
|||
{
|
||||
struct inverse_uint32_set_node *n;
|
||||
const uint32_t idp1 = id + 1;
|
||||
ut_avlIPath_t ip;
|
||||
if ((n = ut_avlLookupPredEq(&inverse_uint32_set_td, &set->ids, &id)) != NULL && id <= n->max + 1) {
|
||||
ddsrt_avl_ipath_t ip;
|
||||
if ((n = ddsrt_avl_lookup_pred_eq(&inverse_uint32_set_td, &set->ids, &id)) != NULL && id <= n->max + 1) {
|
||||
if (id <= n->max)
|
||||
{
|
||||
/* n is [a,b] s.t. a <= I <= b: so it is already in the set */
|
||||
|
@ -143,18 +143,18 @@ void inverse_uint32_set_free(struct inverse_uint32_set *set, uint32_t id)
|
|||
else
|
||||
{
|
||||
struct inverse_uint32_set_node *n1;
|
||||
ut_avlDPath_t dp;
|
||||
ddsrt_avl_dpath_t dp;
|
||||
/* grow the interval, possibly coalesce with next */
|
||||
if ((n1 = ut_avlLookupDPath(&inverse_uint32_set_td, &set->ids, &idp1, &dp)) == NULL) {
|
||||
if ((n1 = ddsrt_avl_lookup_dpath(&inverse_uint32_set_td, &set->ids, &idp1, &dp)) == NULL) {
|
||||
n->max = id;
|
||||
} else {
|
||||
n->max = n1->max;
|
||||
ut_avlDeleteDPath(&inverse_uint32_set_td, &set->ids, n1, &dp);
|
||||
ddsrt_avl_delete_dpath(&inverse_uint32_set_td, &set->ids, n1, &dp);
|
||||
ddsrt_free(n1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((n = ut_avlLookupIPath(&inverse_uint32_set_td, &set->ids, &idp1, &ip)) != NULL) {
|
||||
else if ((n = ddsrt_avl_lookup_ipath(&inverse_uint32_set_td, &set->ids, &idp1, &ip)) != NULL) {
|
||||
/* changing the key in-place here: the key value may be changing, but the structure of the tree is not or the previous case would have applied */
|
||||
n->min = id;
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ void inverse_uint32_set_free(struct inverse_uint32_set *set, uint32_t id)
|
|||
/* no adjacent interval */
|
||||
n = ddsrt_malloc(sizeof(*n));
|
||||
n->min = n->max = id;
|
||||
ut_avlInsertIPath(&inverse_uint32_set_td, &set->ids, n, &ip);
|
||||
ddsrt_avl_insert_ipath(&inverse_uint32_set_td, &set->ids, n, &ip);
|
||||
}
|
||||
check(set);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "dds/ddsrt/heap.h"
|
||||
#include "dds/ddsrt/sync.h"
|
||||
|
||||
#include "dds/util/ut_fibheap.h"
|
||||
#include "dds/ddsrt/fibheap.h"
|
||||
|
||||
#include "dds/ddsi/ddsi_serdata_default.h"
|
||||
#include "dds/ddsi/q_protocol.h"
|
||||
|
@ -44,7 +44,7 @@
|
|||
#define TSCHED_NOT_ON_HEAP INT64_MIN
|
||||
|
||||
struct lease {
|
||||
ut_fibheapNode_t heapnode;
|
||||
ddsrt_fibheap_node_t heapnode;
|
||||
nn_etime_t tsched; /* access guarded by leaseheap_lock */
|
||||
nn_etime_t tend; /* access guarded by lock_lease/unlock_lease */
|
||||
int64_t tdur; /* constant (renew depends on it) */
|
||||
|
@ -53,7 +53,7 @@ struct lease {
|
|||
|
||||
static int compare_lease_tsched (const void *va, const void *vb);
|
||||
|
||||
static const ut_fibheapDef_t lease_fhdef = UT_FIBHEAPDEF_INITIALIZER(offsetof (struct lease, heapnode), compare_lease_tsched);
|
||||
static const ddsrt_fibheap_def_t lease_fhdef = DDSRT_FIBHEAPDEF_INITIALIZER(offsetof (struct lease, heapnode), compare_lease_tsched);
|
||||
|
||||
static void force_lease_check (void)
|
||||
{
|
||||
|
@ -73,13 +73,13 @@ void lease_management_init (void)
|
|||
ddsrt_mutex_init (&gv.leaseheap_lock);
|
||||
for (i = 0; i < N_LEASE_LOCKS; i++)
|
||||
ddsrt_mutex_init (&gv.lease_locks[i]);
|
||||
ut_fibheapInit (&lease_fhdef, &gv.leaseheap);
|
||||
ddsrt_fibheap_init (&lease_fhdef, &gv.leaseheap);
|
||||
}
|
||||
|
||||
void lease_management_term (void)
|
||||
{
|
||||
int i;
|
||||
assert (ut_fibheapMin (&lease_fhdef, &gv.leaseheap) == NULL);
|
||||
assert (ddsrt_fibheap_min (&lease_fhdef, &gv.leaseheap) == NULL);
|
||||
for (i = 0; i < N_LEASE_LOCKS; i++)
|
||||
ddsrt_mutex_destroy (&gv.lease_locks[i]);
|
||||
ddsrt_mutex_destroy (&gv.leaseheap_lock);
|
||||
|
@ -125,7 +125,7 @@ void lease_register (struct lease *l)
|
|||
if (l->tend.v != T_NEVER)
|
||||
{
|
||||
l->tsched = l->tend;
|
||||
ut_fibheapInsert (&lease_fhdef, &gv.leaseheap, l);
|
||||
ddsrt_fibheap_insert (&lease_fhdef, &gv.leaseheap, l);
|
||||
}
|
||||
unlock_lease (l);
|
||||
ddsrt_mutex_unlock (&gv.leaseheap_lock);
|
||||
|
@ -139,7 +139,7 @@ void lease_free (struct lease *l)
|
|||
DDS_TRACE("lease_free(l %p guid %x:%x:%x:%x)\n", (void *) l, PGUID (l->entity->guid));
|
||||
ddsrt_mutex_lock (&gv.leaseheap_lock);
|
||||
if (l->tsched.v != TSCHED_NOT_ON_HEAP)
|
||||
ut_fibheapDelete (&lease_fhdef, &gv.leaseheap, l);
|
||||
ddsrt_fibheap_delete (&lease_fhdef, &gv.leaseheap, l);
|
||||
ddsrt_mutex_unlock (&gv.leaseheap_lock);
|
||||
ddsrt_free (l);
|
||||
|
||||
|
@ -187,14 +187,14 @@ void lease_set_expiry (struct lease *l, nn_etime_t when)
|
|||
/* moved forward and currently scheduled (by virtue of
|
||||
TSCHED_NOT_ON_HEAP == INT64_MIN) */
|
||||
l->tsched = l->tend;
|
||||
ut_fibheapDecreaseKey (&lease_fhdef, &gv.leaseheap, l);
|
||||
ddsrt_fibheap_decrease_key (&lease_fhdef, &gv.leaseheap, l);
|
||||
trigger = true;
|
||||
}
|
||||
else if (l->tsched.v == TSCHED_NOT_ON_HEAP && l->tend.v < T_NEVER)
|
||||
{
|
||||
/* not currently scheduled, with a finite new expiry time */
|
||||
l->tsched = l->tend;
|
||||
ut_fibheapInsert (&lease_fhdef, &gv.leaseheap, l);
|
||||
ddsrt_fibheap_insert (&lease_fhdef, &gv.leaseheap, l);
|
||||
trigger = true;
|
||||
}
|
||||
unlock_lease (l);
|
||||
|
@ -210,13 +210,13 @@ int64_t check_and_handle_lease_expiration (nn_etime_t tnowE)
|
|||
struct lease *l;
|
||||
int64_t delay;
|
||||
ddsrt_mutex_lock (&gv.leaseheap_lock);
|
||||
while ((l = ut_fibheapMin (&lease_fhdef, &gv.leaseheap)) != NULL && l->tsched.v <= tnowE.v)
|
||||
while ((l = ddsrt_fibheap_min (&lease_fhdef, &gv.leaseheap)) != NULL && l->tsched.v <= tnowE.v)
|
||||
{
|
||||
nn_guid_t g = l->entity->guid;
|
||||
enum entity_kind k = l->entity->kind;
|
||||
|
||||
assert (l->tsched.v != TSCHED_NOT_ON_HEAP);
|
||||
ut_fibheapExtractMin (&lease_fhdef, &gv.leaseheap);
|
||||
ddsrt_fibheap_extract_min (&lease_fhdef, &gv.leaseheap);
|
||||
|
||||
lock_lease (l);
|
||||
if (tnowE.v < l->tend.v)
|
||||
|
@ -228,7 +228,7 @@ int64_t check_and_handle_lease_expiration (nn_etime_t tnowE)
|
|||
} else {
|
||||
l->tsched = l->tend;
|
||||
unlock_lease (l);
|
||||
ut_fibheapInsert (&lease_fhdef, &gv.leaseheap, l);
|
||||
ddsrt_fibheap_insert (&lease_fhdef, &gv.leaseheap, l);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ int64_t check_and_handle_lease_expiration (nn_etime_t tnowE)
|
|||
PGUID (proxypp->privileged_pp_guid));
|
||||
l->tsched = l->tend = add_duration_to_etime (tnowE, 200 * T_MILLISECOND);
|
||||
unlock_lease (l);
|
||||
ut_fibheapInsert (&lease_fhdef, &gv.leaseheap, l);
|
||||
ddsrt_fibheap_insert (&lease_fhdef, &gv.leaseheap, l);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "dds/ddsi/q_addrset.h" /* unspec locator */
|
||||
#include "dds/ddsi/q_feature_check.h"
|
||||
#include "dds/ddsi/ddsi_ipaddr.h"
|
||||
#include "dds/util/ut_avl.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
|
||||
static void print_sockerror (const char *msg)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "dds/ddsi/q_radmin.h" /* for nn_plist_quickscan */
|
||||
#include "dds/ddsi/q_static_assert.h"
|
||||
|
||||
#include "dds/util/ut_avl.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
#include "dds/ddsi/q_misc.h" /* for vendor_is_... */
|
||||
|
||||
/* These are internal to the parameter list processing. We never
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "dds/ddsrt/string.h"
|
||||
#include "dds/ddsrt/log.h"
|
||||
|
||||
#include "dds/util/ut_avl.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
#include "dds/ddsi/q_protocol.h"
|
||||
#include "dds/ddsi/q_rtps.h"
|
||||
#include "dds/ddsi/q_misc.h"
|
||||
|
@ -812,7 +812,7 @@ static void nn_rdata_unref (struct nn_rdata *rdata)
|
|||
anyway). */
|
||||
|
||||
struct nn_defrag_iv {
|
||||
ut_avlNode_t avlnode; /* for nn_rsample.defrag::fragtree */
|
||||
ddsrt_avl_node_t avlnode; /* for nn_rsample.defrag::fragtree */
|
||||
uint32_t min, maxp1;
|
||||
struct nn_rdata *first;
|
||||
struct nn_rdata *last;
|
||||
|
@ -821,14 +821,14 @@ struct nn_defrag_iv {
|
|||
struct nn_rsample {
|
||||
union {
|
||||
struct nn_rsample_defrag {
|
||||
ut_avlNode_t avlnode; /* for nn_defrag::sampletree */
|
||||
ut_avlTree_t fragtree;
|
||||
ddsrt_avl_node_t avlnode; /* for nn_defrag::sampletree */
|
||||
ddsrt_avl_tree_t fragtree;
|
||||
struct nn_defrag_iv *lastfrag;
|
||||
struct nn_rsample_info *sampleinfo;
|
||||
seqno_t seq;
|
||||
} defrag;
|
||||
struct nn_rsample_reorder {
|
||||
ut_avlNode_t avlnode; /* for nn_reorder::sampleivtree, if head of a chain */
|
||||
ddsrt_avl_node_t avlnode; /* for nn_reorder::sampleivtree, if head of a chain */
|
||||
struct nn_rsample_chain sc; /* this interval's samples, covering ... */
|
||||
seqno_t min, maxp1; /* ... seq nos: [min,maxp1), but possibly with holes in it */
|
||||
uint32_t n_samples; /* so this is the actual length of the chain */
|
||||
|
@ -837,7 +837,7 @@ struct nn_rsample {
|
|||
};
|
||||
|
||||
struct nn_defrag {
|
||||
ut_avlTree_t sampletree;
|
||||
ddsrt_avl_tree_t sampletree;
|
||||
struct nn_rsample *max_sample; /* = max(sampletree) */
|
||||
uint32_t n_samples;
|
||||
uint32_t max_samples;
|
||||
|
@ -847,8 +847,8 @@ struct nn_defrag {
|
|||
static int compare_uint32 (const void *va, const void *vb);
|
||||
static int compare_seqno (const void *va, const void *vb);
|
||||
|
||||
static const ut_avlTreedef_t defrag_sampletree_treedef = UT_AVL_TREEDEF_INITIALIZER (offsetof (struct nn_rsample, u.defrag.avlnode), offsetof (struct nn_rsample, u.defrag.seq), compare_seqno, 0);
|
||||
static const ut_avlTreedef_t rsample_defrag_fragtree_treedef = UT_AVL_TREEDEF_INITIALIZER (offsetof (struct nn_defrag_iv, avlnode), offsetof (struct nn_defrag_iv, min), compare_uint32, 0);
|
||||
static const ddsrt_avl_treedef_t defrag_sampletree_treedef = DDSRT_AVL_TREEDEF_INITIALIZER (offsetof (struct nn_rsample, u.defrag.avlnode), offsetof (struct nn_rsample, u.defrag.seq), compare_seqno, 0);
|
||||
static const ddsrt_avl_treedef_t rsample_defrag_fragtree_treedef = DDSRT_AVL_TREEDEF_INITIALIZER (offsetof (struct nn_defrag_iv, avlnode), offsetof (struct nn_defrag_iv, min), compare_uint32, 0);
|
||||
|
||||
static int compare_uint32 (const void *va, const void *vb)
|
||||
{
|
||||
|
@ -870,7 +870,7 @@ struct nn_defrag *nn_defrag_new (enum nn_defrag_drop_mode drop_mode, uint32_t ma
|
|||
assert (max_samples >= 1);
|
||||
if ((d = ddsrt_malloc (sizeof (*d))) == NULL)
|
||||
return NULL;
|
||||
ut_avlInit (&defrag_sampletree_treedef, &d->sampletree);
|
||||
ddsrt_avl_init (&defrag_sampletree_treedef, &d->sampletree);
|
||||
d->drop_mode = drop_mode;
|
||||
d->max_samples = max_samples;
|
||||
d->n_samples = 0;
|
||||
|
@ -903,25 +903,25 @@ static void defrag_rsample_drop (struct nn_defrag *defrag, struct nn_rsample *rs
|
|||
So we need to walk the fragments while guaranteeing strict
|
||||
"forward progress" in the memory accesses, which this particular
|
||||
inorder treewalk does provide. */
|
||||
ut_avlIter_t iter;
|
||||
ddsrt_avl_iter_t iter;
|
||||
struct nn_defrag_iv *iv;
|
||||
DDS_LOG(DDS_LC_RADMIN, " defrag_rsample_drop (%p, %p)\n", (void *) defrag, (void *) rsample);
|
||||
ut_avlDelete (&defrag_sampletree_treedef, &defrag->sampletree, rsample);
|
||||
ddsrt_avl_delete (&defrag_sampletree_treedef, &defrag->sampletree, rsample);
|
||||
assert (defrag->n_samples > 0);
|
||||
defrag->n_samples--;
|
||||
for (iv = ut_avlIterFirst (&rsample_defrag_fragtree_treedef, &rsample->u.defrag.fragtree, &iter); iv; iv = ut_avlIterNext (&iter))
|
||||
for (iv = ddsrt_avl_iter_first (&rsample_defrag_fragtree_treedef, &rsample->u.defrag.fragtree, &iter); iv; iv = ddsrt_avl_iter_next (&iter))
|
||||
nn_fragchain_rmbias (iv->first);
|
||||
}
|
||||
|
||||
void nn_defrag_free (struct nn_defrag *defrag)
|
||||
{
|
||||
struct nn_rsample *s;
|
||||
s = ut_avlFindMin (&defrag_sampletree_treedef, &defrag->sampletree);
|
||||
s = ddsrt_avl_find_min (&defrag_sampletree_treedef, &defrag->sampletree);
|
||||
while (s)
|
||||
{
|
||||
DDS_LOG(DDS_LC_RADMIN, "defrag_free(%p, sample %p seq %"PRId64")\n", (void *) defrag, (void *) s, s->u.defrag.seq);
|
||||
defrag_rsample_drop (defrag, s);
|
||||
s = ut_avlFindMin (&defrag_sampletree_treedef, &defrag->sampletree);
|
||||
s = ddsrt_avl_find_min (&defrag_sampletree_treedef, &defrag->sampletree);
|
||||
}
|
||||
assert (defrag->n_samples == 0);
|
||||
ddsrt_free (defrag);
|
||||
|
@ -940,7 +940,7 @@ static int defrag_try_merge_with_succ (struct nn_rsample_defrag *sample, struct
|
|||
return 0;
|
||||
}
|
||||
|
||||
succ = ut_avlFindSucc (&rsample_defrag_fragtree_treedef, &sample->fragtree, node);
|
||||
succ = ddsrt_avl_find_succ (&rsample_defrag_fragtree_treedef, &sample->fragtree, node);
|
||||
assert (succ != NULL);
|
||||
DDS_LOG(DDS_LC_RADMIN, " succ is %p [%u..%u)\n", (void *) succ, succ->min, succ->maxp1);
|
||||
if (succ->min > node->maxp1)
|
||||
|
@ -955,7 +955,7 @@ static int defrag_try_merge_with_succ (struct nn_rsample_defrag *sample, struct
|
|||
/* no longer a gap between node & succ => succ will be removed
|
||||
from the interval tree and therefore node will become the
|
||||
last interval if succ currently is */
|
||||
ut_avlDelete (&rsample_defrag_fragtree_treedef, &sample->fragtree, succ);
|
||||
ddsrt_avl_delete (&rsample_defrag_fragtree_treedef, &sample->fragtree, succ);
|
||||
if (sample->lastfrag == succ)
|
||||
{
|
||||
DDS_LOG(DDS_LC_RADMIN, " succ is lastfrag\n");
|
||||
|
@ -987,7 +987,7 @@ static int defrag_try_merge_with_succ (struct nn_rsample_defrag *sample, struct
|
|||
}
|
||||
}
|
||||
|
||||
static void defrag_rsample_addiv (struct nn_rsample_defrag *sample, struct nn_rdata *rdata, ut_avlIPath_t *path)
|
||||
static void defrag_rsample_addiv (struct nn_rsample_defrag *sample, struct nn_rdata *rdata, ddsrt_avl_ipath_t *path)
|
||||
{
|
||||
struct nn_defrag_iv *newiv;
|
||||
if ((newiv = nn_rmsg_alloc (rdata->rmsg, sizeof (*newiv))) == NULL)
|
||||
|
@ -997,7 +997,7 @@ static void defrag_rsample_addiv (struct nn_rsample_defrag *sample, struct nn_rd
|
|||
newiv->min = rdata->min;
|
||||
newiv->maxp1 = rdata->maxp1;
|
||||
nn_rdata_addbias (rdata);
|
||||
ut_avlInsertIPath (&rsample_defrag_fragtree_treedef, &sample->fragtree, newiv, path);
|
||||
ddsrt_avl_insert_ipath (&rsample_defrag_fragtree_treedef, &sample->fragtree, newiv, path);
|
||||
if (sample->lastfrag == NULL || rdata->min > sample->lastfrag->min)
|
||||
sample->lastfrag = newiv;
|
||||
}
|
||||
|
@ -1010,7 +1010,7 @@ static struct nn_rsample *defrag_rsample_new (struct nn_rdata *rdata, const stru
|
|||
{
|
||||
struct nn_rsample *rsample;
|
||||
struct nn_rsample_defrag *dfsample;
|
||||
ut_avlIPath_t ivpath;
|
||||
ddsrt_avl_ipath_t ivpath;
|
||||
|
||||
if ((rsample = nn_rmsg_alloc (rdata->rmsg, sizeof (*rsample))) == NULL)
|
||||
return NULL;
|
||||
|
@ -1022,7 +1022,7 @@ static struct nn_rsample *defrag_rsample_new (struct nn_rdata *rdata, const stru
|
|||
return NULL;
|
||||
*dfsample->sampleinfo = *sampleinfo;
|
||||
|
||||
ut_avlInit (&rsample_defrag_fragtree_treedef, &dfsample->fragtree);
|
||||
ddsrt_avl_init (&rsample_defrag_fragtree_treedef, &dfsample->fragtree);
|
||||
|
||||
/* add sentinel if rdata is not the first fragment of the message */
|
||||
if (rdata->min > 0)
|
||||
|
@ -1032,12 +1032,12 @@ static struct nn_rsample *defrag_rsample_new (struct nn_rdata *rdata, const stru
|
|||
return NULL;
|
||||
sentinel->first = sentinel->last = NULL;
|
||||
sentinel->min = sentinel->maxp1 = 0;
|
||||
ut_avlLookupIPath (&rsample_defrag_fragtree_treedef, &dfsample->fragtree, &sentinel->min, &ivpath);
|
||||
ut_avlInsertIPath (&rsample_defrag_fragtree_treedef, &dfsample->fragtree, sentinel, &ivpath);
|
||||
ddsrt_avl_lookup_ipath (&rsample_defrag_fragtree_treedef, &dfsample->fragtree, &sentinel->min, &ivpath);
|
||||
ddsrt_avl_insert_ipath (&rsample_defrag_fragtree_treedef, &dfsample->fragtree, sentinel, &ivpath);
|
||||
}
|
||||
|
||||
/* add an interval for the first received fragment */
|
||||
ut_avlLookupIPath (&rsample_defrag_fragtree_treedef, &dfsample->fragtree, &rdata->min, &ivpath);
|
||||
ddsrt_avl_lookup_ipath (&rsample_defrag_fragtree_treedef, &dfsample->fragtree, &rdata->min, &ivpath);
|
||||
defrag_rsample_addiv (dfsample, rdata, &ivpath);
|
||||
return rsample;
|
||||
}
|
||||
|
@ -1084,7 +1084,7 @@ static int is_complete (const struct nn_rsample_defrag *sample)
|
|||
one interval covering all bytes. One interval because of the
|
||||
greedy coalescing in add_fragment(). There is at least one
|
||||
interval if we get here. */
|
||||
const struct nn_defrag_iv *iv = ut_avlRoot (&rsample_defrag_fragtree_treedef, &sample->fragtree);
|
||||
const struct nn_defrag_iv *iv = ddsrt_avl_root (&rsample_defrag_fragtree_treedef, &sample->fragtree);
|
||||
assert (iv != NULL);
|
||||
if (iv->min == 0 && iv->maxp1 >= sample->sampleinfo->size)
|
||||
{
|
||||
|
@ -1094,7 +1094,7 @@ static int is_complete (const struct nn_rsample_defrag *sample)
|
|||
samples that will never be completed; dropping them in the
|
||||
defragmenter would be feasible by discarding all fragments of
|
||||
that sample collected so far. */
|
||||
assert (ut_avlIsSingleton (&sample->fragtree));
|
||||
assert (ddsrt_avl_is_singleton (&sample->fragtree));
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
|
@ -1111,14 +1111,14 @@ static void rsample_convert_defrag_to_reorder (struct nn_rsample *sample)
|
|||
self-respecting compiler will optimise them away, and any
|
||||
self-respecting CPU would need to copy them via registers anyway
|
||||
because it uses a load-store architecture. */
|
||||
struct nn_defrag_iv *iv = ut_avlRootNonEmpty (&rsample_defrag_fragtree_treedef, &sample->u.defrag.fragtree);
|
||||
struct nn_defrag_iv *iv = ddsrt_avl_root_non_empty (&rsample_defrag_fragtree_treedef, &sample->u.defrag.fragtree);
|
||||
struct nn_rdata *fragchain = iv->first;
|
||||
struct nn_rsample_info *sampleinfo = sample->u.defrag.sampleinfo;
|
||||
struct nn_rsample_chain_elem *sce;
|
||||
seqno_t seq = sample->u.defrag.seq;
|
||||
|
||||
/* re-use memory fragment interval node for sample chain */
|
||||
sce = (struct nn_rsample_chain_elem *) ut_avlRootNonEmpty (&rsample_defrag_fragtree_treedef, &sample->u.defrag.fragtree);
|
||||
sce = (struct nn_rsample_chain_elem *) ddsrt_avl_root_non_empty (&rsample_defrag_fragtree_treedef, &sample->u.defrag.fragtree);
|
||||
sce->fragchain = fragchain;
|
||||
sce->next = NULL;
|
||||
sce->sampleinfo = sampleinfo;
|
||||
|
@ -1145,7 +1145,7 @@ static struct nn_rsample *defrag_add_fragment (struct nn_rsample *sample, struct
|
|||
/* there must be a last fragment */
|
||||
assert (dfsample->lastfrag);
|
||||
/* relatively expensive test: lastfrag, tree must be consistent */
|
||||
assert (dfsample->lastfrag == ut_avlFindMax (&rsample_defrag_fragtree_treedef, &dfsample->fragtree));
|
||||
assert (dfsample->lastfrag == ddsrt_avl_find_max (&rsample_defrag_fragtree_treedef, &dfsample->fragtree));
|
||||
|
||||
DDS_LOG(DDS_LC_RADMIN, " lastfrag %p [%u..%u)\n",
|
||||
(void *) dfsample->lastfrag,
|
||||
|
@ -1162,7 +1162,7 @@ static struct nn_rsample *defrag_add_fragment (struct nn_rsample *sample, struct
|
|||
else
|
||||
{
|
||||
/* Slow path: find preceding fragment by tree search */
|
||||
predeq = ut_avlLookupPredEq (&rsample_defrag_fragtree_treedef, &dfsample->fragtree, &min);
|
||||
predeq = ddsrt_avl_lookup_pred_eq (&rsample_defrag_fragtree_treedef, &dfsample->fragtree, &min);
|
||||
assert (predeq);
|
||||
DDS_LOG(DDS_LC_RADMIN, " slow path: predeq = lookup %u => %p [%u..%u)\n",
|
||||
min, (void *) predeq, predeq->min, predeq->maxp1);
|
||||
|
@ -1206,7 +1206,7 @@ static struct nn_rsample *defrag_add_fragment (struct nn_rsample *sample, struct
|
|||
return is_complete (dfsample) ? sample : NULL;
|
||||
}
|
||||
else if (predeq != dfsample->lastfrag && /* if predeq is last frag, there is no succ */
|
||||
(succ = ut_avlFindSucc (&rsample_defrag_fragtree_treedef, &dfsample->fragtree, predeq)) != NULL &&
|
||||
(succ = ddsrt_avl_find_succ (&rsample_defrag_fragtree_treedef, &dfsample->fragtree, predeq)) != NULL &&
|
||||
succ->min <= maxp1)
|
||||
{
|
||||
/* extends succ (at the low end; no guarantee each individual
|
||||
|
@ -1236,9 +1236,9 @@ static struct nn_rsample *defrag_add_fragment (struct nn_rsample *sample, struct
|
|||
{
|
||||
/* doesn't extend either predeq at the end or succ at the head =>
|
||||
new interval; rdata did not cause completion of sample */
|
||||
ut_avlIPath_t path;
|
||||
ddsrt_avl_ipath_t path;
|
||||
DDS_LOG(DDS_LC_RADMIN, " new interval\n");
|
||||
if (ut_avlLookupIPath (&rsample_defrag_fragtree_treedef, &dfsample->fragtree, &min, &path))
|
||||
if (ddsrt_avl_lookup_ipath (&rsample_defrag_fragtree_treedef, &dfsample->fragtree, &min, &path))
|
||||
assert (0);
|
||||
defrag_rsample_addiv (dfsample, rdata, &path);
|
||||
return NULL;
|
||||
|
@ -1274,7 +1274,7 @@ static int defrag_limit_samples (struct nn_defrag *defrag, seqno_t seq, seqno_t
|
|||
break;
|
||||
case NN_DEFRAG_DROP_OLDEST:
|
||||
DDS_LOG(DDS_LC_RADMIN, " drop mode = DROP_OLDEST\n");
|
||||
sample_to_drop = ut_avlFindMin (&defrag_sampletree_treedef, &defrag->sampletree);
|
||||
sample_to_drop = ddsrt_avl_find_min (&defrag_sampletree_treedef, &defrag->sampletree);
|
||||
assert (sample_to_drop);
|
||||
if (seq < sample_to_drop->u.defrag.seq)
|
||||
{
|
||||
|
@ -1287,7 +1287,7 @@ static int defrag_limit_samples (struct nn_defrag *defrag, seqno_t seq, seqno_t
|
|||
defrag_rsample_drop (defrag, sample_to_drop);
|
||||
if (sample_to_drop == defrag->max_sample)
|
||||
{
|
||||
defrag->max_sample = ut_avlFindMax (&defrag_sampletree_treedef, &defrag->sampletree);
|
||||
defrag->max_sample = ddsrt_avl_find_max (&defrag_sampletree_treedef, &defrag->sampletree);
|
||||
*max_seq = defrag->max_sample ? defrag->max_sample->u.defrag.seq : 0;
|
||||
DDS_LOG(DDS_LC_RADMIN, " updating max_sample: now %p %"PRId64"\n",
|
||||
(void *) defrag->max_sample,
|
||||
|
@ -1322,7 +1322,7 @@ struct nn_rsample *nn_defrag_rsample (struct nn_defrag *defrag, struct nn_rdata
|
|||
by adding BIAS to the refcount. */
|
||||
struct nn_rsample *sample, *result;
|
||||
seqno_t max_seq;
|
||||
ut_avlIPath_t path;
|
||||
ddsrt_avl_ipath_t path;
|
||||
|
||||
assert (defrag->n_samples <= defrag->max_samples);
|
||||
|
||||
|
@ -1334,7 +1334,7 @@ struct nn_rsample *nn_defrag_rsample (struct nn_defrag *defrag, struct nn_rdata
|
|||
/* max_seq is used for the fast path, and is 0 when there is no
|
||||
last message in 'defrag'. max_seq and max_sample must be
|
||||
consistent. Max_sample must be consistent with tree */
|
||||
assert (defrag->max_sample == ut_avlFindMax (&defrag_sampletree_treedef, &defrag->sampletree));
|
||||
assert (defrag->max_sample == ddsrt_avl_find_max (&defrag_sampletree_treedef, &defrag->sampletree));
|
||||
max_seq = defrag->max_sample ? defrag->max_sample->u.defrag.seq : 0;
|
||||
DDS_LOG(DDS_LC_RADMIN, "defrag_rsample(%p, %p [%u..%u) msg %p, %p seq %"PRId64" size %u) max_seq %p %"PRId64":\n",
|
||||
(void *) defrag, (void *) rdata, rdata->min, rdata->maxp1, (void *) rdata->rmsg,
|
||||
|
@ -1358,22 +1358,22 @@ struct nn_rsample *nn_defrag_rsample (struct nn_defrag *defrag, struct nn_rdata
|
|||
child of the old maximum node */
|
||||
/* FIXME: MERGE THIS ONE WITH THE NEXT */
|
||||
DDS_LOG(DDS_LC_RADMIN, " new max sample\n");
|
||||
ut_avlLookupIPath (&defrag_sampletree_treedef, &defrag->sampletree, &sampleinfo->seq, &path);
|
||||
ddsrt_avl_lookup_ipath (&defrag_sampletree_treedef, &defrag->sampletree, &sampleinfo->seq, &path);
|
||||
if ((sample = defrag_rsample_new (rdata, sampleinfo)) == NULL)
|
||||
return NULL;
|
||||
ut_avlInsertIPath (&defrag_sampletree_treedef, &defrag->sampletree, sample, &path);
|
||||
ddsrt_avl_insert_ipath (&defrag_sampletree_treedef, &defrag->sampletree, sample, &path);
|
||||
defrag->max_sample = sample;
|
||||
defrag->n_samples++;
|
||||
result = NULL;
|
||||
}
|
||||
else if ((sample = ut_avlLookupIPath (&defrag_sampletree_treedef, &defrag->sampletree, &sampleinfo->seq, &path)) == NULL)
|
||||
else if ((sample = ddsrt_avl_lookup_ipath (&defrag_sampletree_treedef, &defrag->sampletree, &sampleinfo->seq, &path)) == NULL)
|
||||
{
|
||||
/* a new sequence number, but smaller than the maximum */
|
||||
DDS_LOG(DDS_LC_RADMIN, " new sample less than max\n");
|
||||
assert (sampleinfo->seq < max_seq);
|
||||
if ((sample = defrag_rsample_new (rdata, sampleinfo)) == NULL)
|
||||
return NULL;
|
||||
ut_avlInsertIPath (&defrag_sampletree_treedef, &defrag->sampletree, sample, &path);
|
||||
ddsrt_avl_insert_ipath (&defrag_sampletree_treedef, &defrag->sampletree, sample, &path);
|
||||
defrag->n_samples++;
|
||||
result = NULL;
|
||||
}
|
||||
|
@ -1390,12 +1390,12 @@ struct nn_rsample *nn_defrag_rsample (struct nn_defrag *defrag, struct nn_rdata
|
|||
reorder format. If it is the sample with the maximum sequence in
|
||||
the tree, an update of max_sample is required. */
|
||||
DDS_LOG(DDS_LC_RADMIN, " complete\n");
|
||||
ut_avlDelete (&defrag_sampletree_treedef, &defrag->sampletree, result);
|
||||
ddsrt_avl_delete (&defrag_sampletree_treedef, &defrag->sampletree, result);
|
||||
assert (defrag->n_samples > 0);
|
||||
defrag->n_samples--;
|
||||
if (result == defrag->max_sample)
|
||||
{
|
||||
defrag->max_sample = ut_avlFindMax (&defrag_sampletree_treedef, &defrag->sampletree);
|
||||
defrag->max_sample = ddsrt_avl_find_max (&defrag_sampletree_treedef, &defrag->sampletree);
|
||||
DDS_LOG(DDS_LC_RADMIN, " updating max_sample: now %p %"PRId64"\n",
|
||||
(void *) defrag->max_sample,
|
||||
defrag->max_sample ? defrag->max_sample->u.defrag.seq : 0);
|
||||
|
@ -1403,7 +1403,7 @@ struct nn_rsample *nn_defrag_rsample (struct nn_defrag *defrag, struct nn_rdata
|
|||
rsample_convert_defrag_to_reorder (result);
|
||||
}
|
||||
|
||||
assert (defrag->max_sample == ut_avlFindMax (&defrag_sampletree_treedef, &defrag->sampletree));
|
||||
assert (defrag->max_sample == ddsrt_avl_find_max (&defrag_sampletree_treedef, &defrag->sampletree));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1412,14 +1412,14 @@ void nn_defrag_notegap (struct nn_defrag *defrag, seqno_t min, seqno_t maxp1)
|
|||
/* All sequence numbers in [min,maxp1) are unavailable so any
|
||||
fragments in that range must be discarded. Used both for
|
||||
Hearbeats (by setting min=1) and for Gaps. */
|
||||
struct nn_rsample *s = ut_avlLookupSuccEq (&defrag_sampletree_treedef, &defrag->sampletree, &min);
|
||||
struct nn_rsample *s = ddsrt_avl_lookup_succ_eq (&defrag_sampletree_treedef, &defrag->sampletree, &min);
|
||||
while (s && s->u.defrag.seq < maxp1)
|
||||
{
|
||||
struct nn_rsample *s1 = ut_avlFindSucc (&defrag_sampletree_treedef, &defrag->sampletree, s);
|
||||
struct nn_rsample *s1 = ddsrt_avl_find_succ (&defrag_sampletree_treedef, &defrag->sampletree, s);
|
||||
defrag_rsample_drop (defrag, s);
|
||||
s = s1;
|
||||
}
|
||||
defrag->max_sample = ut_avlFindMax (&defrag_sampletree_treedef, &defrag->sampletree);
|
||||
defrag->max_sample = ddsrt_avl_find_max (&defrag_sampletree_treedef, &defrag->sampletree);
|
||||
}
|
||||
|
||||
int nn_defrag_nackmap (struct nn_defrag *defrag, seqno_t seq, uint32_t maxfragnum, struct nn_fragment_number_set *map, uint32_t maxsz)
|
||||
|
@ -1428,7 +1428,7 @@ int nn_defrag_nackmap (struct nn_defrag *defrag, seqno_t seq, uint32_t maxfragnu
|
|||
struct nn_defrag_iv *iv;
|
||||
uint32_t i, fragsz, nfrags;
|
||||
assert (maxsz <= 256);
|
||||
s = ut_avlLookup (&defrag_sampletree_treedef, &defrag->sampletree, &seq);
|
||||
s = ddsrt_avl_lookup (&defrag_sampletree_treedef, &defrag->sampletree, &seq);
|
||||
if (s == NULL)
|
||||
{
|
||||
if (maxfragnum == UINT32_MAX)
|
||||
|
@ -1465,7 +1465,7 @@ int nn_defrag_nackmap (struct nn_defrag *defrag, seqno_t seq, uint32_t maxfragnu
|
|||
are missing the first fragment. */
|
||||
struct nn_defrag_iv *liv = s->u.defrag.lastfrag;
|
||||
nn_fragment_number_t map_end;
|
||||
iv = ut_avlFindMin (&rsample_defrag_fragtree_treedef, &s->u.defrag.fragtree);
|
||||
iv = ddsrt_avl_find_min (&rsample_defrag_fragtree_treedef, &s->u.defrag.fragtree);
|
||||
assert (iv != NULL);
|
||||
/* iv is first interval, iv->maxp1 is first byte beyond that =>
|
||||
divide by fragsz to get first missing fragment */
|
||||
|
@ -1485,7 +1485,7 @@ int nn_defrag_nackmap (struct nn_defrag *defrag, seqno_t seq, uint32_t maxfragnu
|
|||
map->bitmap_base, but there is nothing to request in that
|
||||
case. */
|
||||
map->numbits = (map_end < map->bitmap_base) ? 0 : map_end - map->bitmap_base + 1;
|
||||
iv = ut_avlFindSucc (&rsample_defrag_fragtree_treedef, &s->u.defrag.fragtree, iv);
|
||||
iv = ddsrt_avl_find_succ (&rsample_defrag_fragtree_treedef, &s->u.defrag.fragtree, iv);
|
||||
}
|
||||
|
||||
/* Clear bitmap, then set bits for gaps in available fragments */
|
||||
|
@ -1515,7 +1515,7 @@ int nn_defrag_nackmap (struct nn_defrag *defrag, seqno_t seq, uint32_t maxfragnu
|
|||
at fragment containing maxp1 (because we don't have that byte
|
||||
yet), and runs until the next interval begins */
|
||||
i = iv->maxp1 / fragsz;
|
||||
iv = ut_avlFindSucc (&rsample_defrag_fragtree_treedef, &s->u.defrag.fragtree, iv);
|
||||
iv = ddsrt_avl_find_succ (&rsample_defrag_fragtree_treedef, &s->u.defrag.fragtree, iv);
|
||||
}
|
||||
/* and set bits for missing fragments beyond the highest interval */
|
||||
for (; i < map->bitmap_base + map->numbits; i++)
|
||||
|
@ -1603,7 +1603,7 @@ int nn_defrag_nackmap (struct nn_defrag *defrag, seqno_t seq, uint32_t maxfragnu
|
|||
in the overview comment at the top of this file. */
|
||||
|
||||
struct nn_reorder {
|
||||
ut_avlTree_t sampleivtree;
|
||||
ddsrt_avl_tree_t sampleivtree;
|
||||
struct nn_rsample *max_sampleiv; /* = max(sampleivtree) */
|
||||
seqno_t next_seq;
|
||||
enum nn_reorder_mode mode;
|
||||
|
@ -1611,15 +1611,15 @@ struct nn_reorder {
|
|||
uint32_t n_samples;
|
||||
};
|
||||
|
||||
static const ut_avlTreedef_t reorder_sampleivtree_treedef =
|
||||
UT_AVL_TREEDEF_INITIALIZER (offsetof (struct nn_rsample, u.reorder.avlnode), offsetof (struct nn_rsample, u.reorder.min), compare_seqno, 0);
|
||||
static const ddsrt_avl_treedef_t reorder_sampleivtree_treedef =
|
||||
DDSRT_AVL_TREEDEF_INITIALIZER (offsetof (struct nn_rsample, u.reorder.avlnode), offsetof (struct nn_rsample, u.reorder.min), compare_seqno, 0);
|
||||
|
||||
struct nn_reorder *nn_reorder_new (enum nn_reorder_mode mode, uint32_t max_samples)
|
||||
{
|
||||
struct nn_reorder *r;
|
||||
if ((r = ddsrt_malloc (sizeof (*r))) == NULL)
|
||||
return NULL;
|
||||
ut_avlInit (&reorder_sampleivtree_treedef, &r->sampleivtree);
|
||||
ddsrt_avl_init (&reorder_sampleivtree_treedef, &r->sampleivtree);
|
||||
r->max_sampleiv = NULL;
|
||||
r->next_seq = 1;
|
||||
r->mode = mode;
|
||||
|
@ -1644,10 +1644,10 @@ void nn_reorder_free (struct nn_reorder *r)
|
|||
struct nn_rsample *iv;
|
||||
struct nn_rsample_chain_elem *sce;
|
||||
/* FXIME: instead of findmin/delete, a treewalk can be used. */
|
||||
iv = ut_avlFindMin (&reorder_sampleivtree_treedef, &r->sampleivtree);
|
||||
iv = ddsrt_avl_find_min (&reorder_sampleivtree_treedef, &r->sampleivtree);
|
||||
while (iv)
|
||||
{
|
||||
ut_avlDelete (&reorder_sampleivtree_treedef, &r->sampleivtree, iv);
|
||||
ddsrt_avl_delete (&reorder_sampleivtree_treedef, &r->sampleivtree, iv);
|
||||
sce = iv->u.reorder.sc.first;
|
||||
while (sce)
|
||||
{
|
||||
|
@ -1655,17 +1655,17 @@ void nn_reorder_free (struct nn_reorder *r)
|
|||
nn_fragchain_unref (sce->fragchain);
|
||||
sce = sce1;
|
||||
}
|
||||
iv = ut_avlFindMin (&reorder_sampleivtree_treedef, &r->sampleivtree);
|
||||
iv = ddsrt_avl_find_min (&reorder_sampleivtree_treedef, &r->sampleivtree);
|
||||
}
|
||||
ddsrt_free (r);
|
||||
}
|
||||
|
||||
static void reorder_add_rsampleiv (struct nn_reorder *reorder, struct nn_rsample *rsample)
|
||||
{
|
||||
ut_avlIPath_t path;
|
||||
if (ut_avlLookupIPath (&reorder_sampleivtree_treedef, &reorder->sampleivtree, &rsample->u.reorder.min, &path) != NULL)
|
||||
ddsrt_avl_ipath_t path;
|
||||
if (ddsrt_avl_lookup_ipath (&reorder_sampleivtree_treedef, &reorder->sampleivtree, &rsample->u.reorder.min, &path) != NULL)
|
||||
assert (0);
|
||||
ut_avlInsertIPath (&reorder_sampleivtree_treedef, &reorder->sampleivtree, rsample, &path);
|
||||
ddsrt_avl_insert_ipath (&reorder_sampleivtree_treedef, &reorder->sampleivtree, rsample, &path);
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
@ -1713,7 +1713,7 @@ static int reorder_try_append_and_discard (struct nn_reorder *reorder, struct nn
|
|||
appendto->u.reorder.min, appendto->u.reorder.maxp1, (void *) appendto,
|
||||
todiscard->u.reorder.min, todiscard->u.reorder.maxp1, (void *) todiscard);
|
||||
assert (todiscard->u.reorder.min == appendto->u.reorder.maxp1);
|
||||
ut_avlDelete (&reorder_sampleivtree_treedef, &reorder->sampleivtree, todiscard);
|
||||
ddsrt_avl_delete (&reorder_sampleivtree_treedef, &reorder->sampleivtree, todiscard);
|
||||
append_rsample_interval (appendto, todiscard);
|
||||
DDS_LOG(DDS_LC_RADMIN, " try_append_and_discard: max_sampleiv needs update? %s\n",
|
||||
(todiscard == reorder->max_sampleiv) ? "yes" : "no");
|
||||
|
@ -1793,8 +1793,8 @@ static void delete_last_sample (struct nn_reorder *reorder)
|
|||
recalc max_sampleiv. */
|
||||
DDS_LOG(DDS_LC_RADMIN, " delete_last_sample: in singleton interval\n");
|
||||
fragchain = last->sc.first->fragchain;
|
||||
ut_avlDelete (&reorder_sampleivtree_treedef, &reorder->sampleivtree, reorder->max_sampleiv);
|
||||
reorder->max_sampleiv = ut_avlFindMax (&reorder_sampleivtree_treedef, &reorder->sampleivtree);
|
||||
ddsrt_avl_delete (&reorder_sampleivtree_treedef, &reorder->sampleivtree, reorder->max_sampleiv);
|
||||
reorder->max_sampleiv = ddsrt_avl_find_max (&reorder_sampleivtree_treedef, &reorder->sampleivtree);
|
||||
/* No harm done if it the sampleivtree is empty, except that we
|
||||
chose not to allow it */
|
||||
assert (reorder->max_sampleiv != NULL);
|
||||
|
@ -1847,7 +1847,7 @@ nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_r
|
|||
seq; max must be set iff the reorder is non-empty. */
|
||||
#ifndef NDEBUG
|
||||
{
|
||||
struct nn_rsample *min = ut_avlFindMin (&reorder_sampleivtree_treedef, &reorder->sampleivtree);
|
||||
struct nn_rsample *min = ddsrt_avl_find_min (&reorder_sampleivtree_treedef, &reorder->sampleivtree);
|
||||
if (min)
|
||||
DDS_LOG(DDS_LC_RADMIN, " min = %"PRId64" @ %p\n", min->u.reorder.min, (void *) min);
|
||||
assert (min == NULL || reorder->next_seq < min->u.reorder.min);
|
||||
|
@ -1855,8 +1855,8 @@ nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_r
|
|||
(reorder->max_sampleiv != NULL && min != NULL));
|
||||
}
|
||||
#endif
|
||||
assert ((!!ut_avlIsEmpty (&reorder->sampleivtree)) == (reorder->max_sampleiv == NULL));
|
||||
assert (reorder->max_sampleiv == NULL || reorder->max_sampleiv == ut_avlFindMax (&reorder_sampleivtree_treedef, &reorder->sampleivtree));
|
||||
assert ((!!ddsrt_avl_is_empty (&reorder->sampleivtree)) == (reorder->max_sampleiv == NULL));
|
||||
assert (reorder->max_sampleiv == NULL || reorder->max_sampleiv == ddsrt_avl_find_max (&reorder_sampleivtree_treedef, &reorder->sampleivtree));
|
||||
assert (reorder->n_samples <= reorder->max_samples);
|
||||
if (reorder->max_sampleiv)
|
||||
DDS_LOG(DDS_LC_RADMIN, " max = [%"PRId64",%"PRId64") @ %p\n", reorder->max_sampleiv->u.reorder.min, reorder->max_sampleiv->u.reorder.maxp1, (void *) reorder->max_sampleiv);
|
||||
|
@ -1883,7 +1883,7 @@ nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_r
|
|||
out-of-order either ends up here or in discard.) */
|
||||
if (reorder->max_sampleiv != NULL)
|
||||
{
|
||||
struct nn_rsample *min = ut_avlFindMin (&reorder_sampleivtree_treedef, &reorder->sampleivtree);
|
||||
struct nn_rsample *min = ddsrt_avl_find_min (&reorder_sampleivtree_treedef, &reorder->sampleivtree);
|
||||
DDS_LOG(DDS_LC_RADMIN, " try append_and_discard\n");
|
||||
if (reorder_try_append_and_discard (reorder, rsampleiv, min))
|
||||
reorder->max_sampleiv = NULL;
|
||||
|
@ -1908,7 +1908,7 @@ nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_r
|
|||
DDS_LOG(DDS_LC_RADMIN, " discard: too old\n");
|
||||
return NN_REORDER_TOO_OLD; /* don't want refcount increment */
|
||||
}
|
||||
else if (ut_avlIsEmpty (&reorder->sampleivtree))
|
||||
else if (ddsrt_avl_is_empty (&reorder->sampleivtree))
|
||||
{
|
||||
/* else, if nothing's stored simply add this one, max_samples = 0
|
||||
is technically allowed, and potentially useful, so check for
|
||||
|
@ -1989,7 +1989,7 @@ nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_r
|
|||
return NN_REORDER_REJECT;
|
||||
}
|
||||
|
||||
predeq = ut_avlLookupPredEq (&reorder_sampleivtree_treedef, &reorder->sampleivtree, &s->min);
|
||||
predeq = ddsrt_avl_lookup_pred_eq (&reorder_sampleivtree_treedef, &reorder->sampleivtree, &s->min);
|
||||
if (predeq)
|
||||
DDS_LOG(DDS_LC_RADMIN, " predeq = [%"PRId64",%"PRId64") @ %p\n",
|
||||
predeq->u.reorder.min, predeq->u.reorder.maxp1, (void *) predeq);
|
||||
|
@ -2002,7 +2002,7 @@ nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_r
|
|||
return NN_REORDER_REJECT;
|
||||
}
|
||||
|
||||
immsucc = ut_avlLookup (&reorder_sampleivtree_treedef, &reorder->sampleivtree, &s->maxp1);
|
||||
immsucc = ddsrt_avl_lookup (&reorder_sampleivtree_treedef, &reorder->sampleivtree, &s->maxp1);
|
||||
if (immsucc)
|
||||
DDS_LOG(DDS_LC_RADMIN, " immsucc = [%"PRId64",%"PRId64") @ %p\n",
|
||||
immsucc->u.reorder.min, immsucc->u.reorder.maxp1, (void *) immsucc);
|
||||
|
@ -2040,7 +2040,7 @@ nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_r
|
|||
Therefore, we can swap rsampleiv in for immsucc and avoid the
|
||||
case above. */
|
||||
rsampleiv->u.reorder = immsucc->u.reorder;
|
||||
ut_avlSwapNode (&reorder_sampleivtree_treedef, &reorder->sampleivtree, immsucc, rsampleiv);
|
||||
ddsrt_avl_swap_node (&reorder_sampleivtree_treedef, &reorder->sampleivtree, immsucc, rsampleiv);
|
||||
if (immsucc == reorder->max_sampleiv)
|
||||
reorder->max_sampleiv = rsampleiv;
|
||||
}
|
||||
|
@ -2072,12 +2072,12 @@ static struct nn_rsample *coalesce_intervals_touching_range (struct nn_reorder *
|
|||
struct nn_rsample *s, *t;
|
||||
*valuable = 0;
|
||||
/* Find first (lowest m) interval [m,n) s.t. n >= min && m <= maxp1 */
|
||||
s = ut_avlLookupPredEq (&reorder_sampleivtree_treedef, &reorder->sampleivtree, &min);
|
||||
s = ddsrt_avl_lookup_pred_eq (&reorder_sampleivtree_treedef, &reorder->sampleivtree, &min);
|
||||
if (s && s->u.reorder.maxp1 >= min)
|
||||
{
|
||||
/* m <= min && n >= min (note: pred of s [m',n') necessarily has n' < m) */
|
||||
#ifndef NDEBUG
|
||||
struct nn_rsample *q = ut_avlFindPred (&reorder_sampleivtree_treedef, &reorder->sampleivtree, s);
|
||||
struct nn_rsample *q = ddsrt_avl_find_pred (&reorder_sampleivtree_treedef, &reorder->sampleivtree, s);
|
||||
assert (q == NULL || q->u.reorder.maxp1 < min);
|
||||
#endif
|
||||
}
|
||||
|
@ -2086,15 +2086,15 @@ static struct nn_rsample *coalesce_intervals_touching_range (struct nn_reorder *
|
|||
/* No good, but the first (if s = NULL) or the next one (if s !=
|
||||
NULL) may still have m <= maxp1 (m > min is implied now). If
|
||||
not, no such interval. */
|
||||
s = ut_avlFindSucc (&reorder_sampleivtree_treedef, &reorder->sampleivtree, s);
|
||||
s = ddsrt_avl_find_succ (&reorder_sampleivtree_treedef, &reorder->sampleivtree, s);
|
||||
if (!(s && s->u.reorder.min <= maxp1))
|
||||
return NULL;
|
||||
}
|
||||
/* Append successors [m',n') s.t. m' <= maxp1 to s */
|
||||
assert (s->u.reorder.min + s->u.reorder.n_samples <= s->u.reorder.maxp1);
|
||||
while ((t = ut_avlFindSucc (&reorder_sampleivtree_treedef, &reorder->sampleivtree, s)) != NULL && t->u.reorder.min <= maxp1)
|
||||
while ((t = ddsrt_avl_find_succ (&reorder_sampleivtree_treedef, &reorder->sampleivtree, s)) != NULL && t->u.reorder.min <= maxp1)
|
||||
{
|
||||
ut_avlDelete (&reorder_sampleivtree_treedef, &reorder->sampleivtree, t);
|
||||
ddsrt_avl_delete (&reorder_sampleivtree_treedef, &reorder->sampleivtree, t);
|
||||
assert (t->u.reorder.min + t->u.reorder.n_samples <= t->u.reorder.maxp1);
|
||||
append_rsample_interval (s, t);
|
||||
*valuable = 1;
|
||||
|
@ -2126,8 +2126,8 @@ static int reorder_insert_gap (struct nn_reorder *reorder, struct nn_rdata *rdat
|
|||
{
|
||||
struct nn_rsample_chain_elem *sce;
|
||||
struct nn_rsample *s;
|
||||
ut_avlIPath_t path;
|
||||
if (ut_avlLookupIPath (&reorder_sampleivtree_treedef, &reorder->sampleivtree, &min, &path) != NULL)
|
||||
ddsrt_avl_ipath_t path;
|
||||
if (ddsrt_avl_lookup_ipath (&reorder_sampleivtree_treedef, &reorder->sampleivtree, &min, &path) != NULL)
|
||||
assert (0);
|
||||
if ((sce = nn_rmsg_alloc (rdata->rmsg, sizeof (*sce))) == NULL)
|
||||
return 0;
|
||||
|
@ -2140,7 +2140,7 @@ static int reorder_insert_gap (struct nn_reorder *reorder, struct nn_rdata *rdat
|
|||
s->u.reorder.min = min;
|
||||
s->u.reorder.maxp1 = maxp1;
|
||||
s->u.reorder.n_samples = 1;
|
||||
ut_avlInsertIPath (&reorder_sampleivtree_treedef, &reorder->sampleivtree, s, &path);
|
||||
ddsrt_avl_insert_ipath (&reorder_sampleivtree_treedef, &reorder->sampleivtree, s, &path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2225,7 +2225,7 @@ nn_reorder_result_t nn_reorder_gap (struct nn_rsample_chain *sc, struct nn_reord
|
|||
delete_last_sample (reorder);
|
||||
(*refcount_adjust)++;
|
||||
}
|
||||
reorder->max_sampleiv = ut_avlFindMax (&reorder_sampleivtree_treedef, &reorder->sampleivtree);
|
||||
reorder->max_sampleiv = ddsrt_avl_find_max (&reorder_sampleivtree_treedef, &reorder->sampleivtree);
|
||||
return res;
|
||||
}
|
||||
else if (coalesced->u.reorder.min <= reorder->next_seq)
|
||||
|
@ -2233,11 +2233,11 @@ nn_reorder_result_t nn_reorder_gap (struct nn_rsample_chain *sc, struct nn_reord
|
|||
DDS_LOG(DDS_LC_RADMIN, " coalesced = [%"PRId64",%"PRId64") @ %p containing %d samples\n",
|
||||
coalesced->u.reorder.min, coalesced->u.reorder.maxp1,
|
||||
(void *) coalesced, coalesced->u.reorder.n_samples);
|
||||
ut_avlDelete (&reorder_sampleivtree_treedef, &reorder->sampleivtree, coalesced);
|
||||
ddsrt_avl_delete (&reorder_sampleivtree_treedef, &reorder->sampleivtree, coalesced);
|
||||
if (coalesced->u.reorder.min <= reorder->next_seq)
|
||||
assert (min <= reorder->next_seq);
|
||||
reorder->next_seq = coalesced->u.reorder.maxp1;
|
||||
reorder->max_sampleiv = ut_avlFindMax (&reorder_sampleivtree_treedef, &reorder->sampleivtree);
|
||||
reorder->max_sampleiv = ddsrt_avl_find_max (&reorder_sampleivtree_treedef, &reorder->sampleivtree);
|
||||
DDS_LOG(DDS_LC_RADMIN, " next expected: %"PRId64"\n", reorder->next_seq);
|
||||
*sc = coalesced->u.reorder.sc;
|
||||
|
||||
|
@ -2251,7 +2251,7 @@ nn_reorder_result_t nn_reorder_gap (struct nn_rsample_chain *sc, struct nn_reord
|
|||
{
|
||||
DDS_LOG(DDS_LC_RADMIN, " coalesced = [%"PRId64",%"PRId64") @ %p - that is all\n",
|
||||
coalesced->u.reorder.min, coalesced->u.reorder.maxp1, (void *) coalesced);
|
||||
reorder->max_sampleiv = ut_avlFindMax (&reorder_sampleivtree_treedef, &reorder->sampleivtree);
|
||||
reorder->max_sampleiv = ddsrt_avl_find_max (&reorder_sampleivtree_treedef, &reorder->sampleivtree);
|
||||
return valuable ? NN_REORDER_ACCEPT : NN_REORDER_REJECT;
|
||||
}
|
||||
}
|
||||
|
@ -2264,7 +2264,7 @@ int nn_reorder_wantsample (struct nn_reorder *reorder, seqno_t seq)
|
|||
return 0;
|
||||
/* Find interval that contains seq, if we know seq. We are
|
||||
interested if seq is outside this interval (if any). */
|
||||
s = ut_avlLookupPredEq (&reorder_sampleivtree_treedef, &reorder->sampleivtree, &seq);
|
||||
s = ddsrt_avl_lookup_pred_eq (&reorder_sampleivtree_treedef, &reorder->sampleivtree, &seq);
|
||||
return (s == NULL || s->u.reorder.maxp1 <= seq);
|
||||
}
|
||||
|
||||
|
@ -2307,7 +2307,7 @@ unsigned nn_reorder_nackmap (struct nn_reorder *reorder, seqno_t base, seqno_t m
|
|||
map->numbits = (uint32_t) (maxseq + 1 - base);
|
||||
nn_bitset_zero (map->numbits, map->bits);
|
||||
|
||||
if ((iv = ut_avlFindMin (&reorder_sampleivtree_treedef, &reorder->sampleivtree)) != NULL)
|
||||
if ((iv = ddsrt_avl_find_min (&reorder_sampleivtree_treedef, &reorder->sampleivtree)) != NULL)
|
||||
assert (iv->u.reorder.min > base);
|
||||
i = base;
|
||||
while (iv && i < base + map->numbits)
|
||||
|
@ -2318,7 +2318,7 @@ unsigned nn_reorder_nackmap (struct nn_reorder *reorder, seqno_t base, seqno_t m
|
|||
nn_bitset_set (map->numbits, map->bits, x);
|
||||
}
|
||||
i = iv->u.reorder.maxp1;
|
||||
iv = ut_avlFindSucc (&reorder_sampleivtree_treedef, &reorder->sampleivtree, iv);
|
||||
iv = ddsrt_avl_find_succ (&reorder_sampleivtree_treedef, &reorder->sampleivtree, iv);
|
||||
}
|
||||
if (notail && i < base + map->numbits)
|
||||
map->numbits = (unsigned) (i - base);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "dds/ddsrt/sync.h"
|
||||
#include "dds/ddsrt/string.h"
|
||||
|
||||
#include "dds/util/ut_avl.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
#include "dds__stream.h"
|
||||
#include "dds/ddsi/q_protocol.h"
|
||||
#include "dds/ddsi/q_rtps.h"
|
||||
|
@ -767,7 +767,7 @@ static int handle_AckNack (struct receiver_state *rst, nn_etime_t tnow, const Ac
|
|||
}
|
||||
|
||||
ddsrt_mutex_lock (&wr->e.lock);
|
||||
if ((rn = ut_avlLookup (&wr_readers_treedef, &wr->readers, &src)) == NULL)
|
||||
if ((rn = ddsrt_avl_lookup (&wr_readers_treedef, &wr->readers, &src)) == NULL)
|
||||
{
|
||||
DDS_TRACE(" %x:%x:%x:%x -> %x:%x:%x:%x not a connection)", PGUID (src), PGUID (dst));
|
||||
goto out;
|
||||
|
@ -823,7 +823,7 @@ static int handle_AckNack (struct receiver_state *rst, nn_etime_t tnow, const Ac
|
|||
that rn->seq <= wr->seq) */
|
||||
rn->seq = wr->seq;
|
||||
}
|
||||
ut_avlAugmentUpdate (&wr_readers_treedef, rn);
|
||||
ddsrt_avl_augment_update (&wr_readers_treedef, rn);
|
||||
n = remove_acked_messages (wr, &whcst, &deferred_free_list);
|
||||
DDS_TRACE(" ACK%"PRId64" RM%u", n_ack, n);
|
||||
}
|
||||
|
@ -850,7 +850,7 @@ static int handle_AckNack (struct receiver_state *rst, nn_etime_t tnow, const Ac
|
|||
that rn->seq <= wr->seq) */
|
||||
rn->seq = wr->seq;
|
||||
}
|
||||
ut_avlAugmentUpdate (&wr_readers_treedef, rn);
|
||||
ddsrt_avl_augment_update (&wr_readers_treedef, rn);
|
||||
DDS_LOG(DDS_LC_THROTTLE, "writer %x:%x:%x:%x considering reader %x:%x:%x:%x responsive again\n", PGUID (wr->e.guid), PGUID (rn->prd_guid));
|
||||
}
|
||||
|
||||
|
@ -867,7 +867,7 @@ static int handle_AckNack (struct receiver_state *rst, nn_etime_t tnow, const Ac
|
|||
rn->has_replied_to_hb = 1;
|
||||
/* walk the whole tree to ensure all proxy readers for this writer
|
||||
have their unack'ed info updated */
|
||||
ut_avlAugmentUpdate (&wr_readers_treedef, rn);
|
||||
ddsrt_avl_augment_update (&wr_readers_treedef, rn);
|
||||
}
|
||||
if (is_preemptive_ack)
|
||||
{
|
||||
|
@ -1075,7 +1075,7 @@ static int handle_AckNack (struct receiver_state *rst, nn_etime_t tnow, const Ac
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void handle_forall_destinations (const nn_guid_t *dst, struct proxy_writer *pwr, ut_avlWalk_t fun, void *arg)
|
||||
static void handle_forall_destinations (const nn_guid_t *dst, struct proxy_writer *pwr, ddsrt_avl_walk_t fun, void *arg)
|
||||
{
|
||||
/* prefix: id: to:
|
||||
0 0 all matched readers
|
||||
|
@ -1093,12 +1093,12 @@ static void handle_forall_destinations (const nn_guid_t *dst, struct proxy_write
|
|||
switch ((haveprefix << 1) | haveid)
|
||||
{
|
||||
case (0 << 1) | 0: /* all: full treewalk */
|
||||
ut_avlWalk (&pwr_readers_treedef, &pwr->readers, fun, arg);
|
||||
ddsrt_avl_walk (&pwr_readers_treedef, &pwr->readers, fun, arg);
|
||||
break;
|
||||
case (0 << 1) | 1: /* all with correct entityid: special filtering treewalk */
|
||||
{
|
||||
struct pwr_rd_match *wn;
|
||||
for (wn = ut_avlFindMin (&pwr_readers_treedef, &pwr->readers); wn; wn = ut_avlFindSucc (&pwr_readers_treedef, &pwr->readers, wn))
|
||||
for (wn = ddsrt_avl_find_min (&pwr_readers_treedef, &pwr->readers); wn; wn = ddsrt_avl_find_succ (&pwr_readers_treedef, &pwr->readers, wn))
|
||||
{
|
||||
if (wn->rd_guid.entityid.u == dst->entityid.u)
|
||||
fun (wn, arg);
|
||||
|
@ -1110,13 +1110,13 @@ static void handle_forall_destinations (const nn_guid_t *dst, struct proxy_write
|
|||
nn_guid_t a, b;
|
||||
a = *dst; a.entityid.u = 0;
|
||||
b = *dst; b.entityid.u = ~0u;
|
||||
ut_avlWalkRange (&pwr_readers_treedef, &pwr->readers, &a, &b, fun, arg);
|
||||
ddsrt_avl_walk_range (&pwr_readers_treedef, &pwr->readers, &a, &b, fun, arg);
|
||||
}
|
||||
break;
|
||||
case (1 << 1) | 1: /* fully addressed: dst should exist (but for removal) */
|
||||
{
|
||||
struct pwr_rd_match *wn;
|
||||
if ((wn = ut_avlLookup (&pwr_readers_treedef, &pwr->readers, dst)) != NULL)
|
||||
if ((wn = ddsrt_avl_lookup (&pwr_readers_treedef, &pwr->readers, dst)) != NULL)
|
||||
fun (wn, arg);
|
||||
}
|
||||
break;
|
||||
|
@ -1289,7 +1289,7 @@ static int handle_Heartbeat (struct receiver_state *rst, nn_etime_t tnow, struct
|
|||
else
|
||||
nn_dqueue_enqueue (pwr->dqueue, &sc, res);
|
||||
}
|
||||
for (wn = ut_avlFindMin (&pwr_readers_treedef, &pwr->readers); wn; wn = ut_avlFindSucc (&pwr_readers_treedef, &pwr->readers, wn))
|
||||
for (wn = ddsrt_avl_find_min (&pwr_readers_treedef, &pwr->readers); wn; wn = ddsrt_avl_find_succ (&pwr_readers_treedef, &pwr->readers, wn))
|
||||
if (wn->in_sync != PRMSS_SYNC)
|
||||
{
|
||||
seqno_t last_deliv_seq = 0;
|
||||
|
@ -1324,7 +1324,7 @@ static int handle_Heartbeat (struct receiver_state *rst, nn_etime_t tnow, struct
|
|||
arg.timestamp = timestamp;
|
||||
arg.tnow = tnow;
|
||||
arg.tnow_mt = now_mt ();
|
||||
handle_forall_destinations (&dst, pwr, (ut_avlWalk_t) handle_Heartbeat_helper, &arg);
|
||||
handle_forall_destinations (&dst, pwr, (ddsrt_avl_walk_t) handle_Heartbeat_helper, &arg);
|
||||
DDS_TRACE(")");
|
||||
|
||||
ddsrt_mutex_unlock (&pwr->e.lock);
|
||||
|
@ -1380,7 +1380,7 @@ static int handle_HeartbeatFrag (struct receiver_state *rst, UNUSED_ARG(nn_etime
|
|||
discover a missing fragment, which differs significantly from
|
||||
handle_Heartbeat's scheduling of an AckNack event when it must
|
||||
respond. Why? Just because. */
|
||||
if (ut_avlIsEmpty (&pwr->readers) || pwr->local_matching_inprogress)
|
||||
if (ddsrt_avl_is_empty (&pwr->readers) || pwr->local_matching_inprogress)
|
||||
DDS_TRACE(" no readers");
|
||||
else
|
||||
{
|
||||
|
@ -1392,19 +1392,19 @@ static int handle_HeartbeatFrag (struct receiver_state *rst, UNUSED_ARG(nn_etime
|
|||
assuming a reliable writer -> unreliable reader is rare, and
|
||||
so scanning the readers is acceptable if the first guess
|
||||
fails */
|
||||
m = ut_avlRootNonEmpty (&pwr_readers_treedef, &pwr->readers);
|
||||
m = ddsrt_avl_root_non_empty (&pwr_readers_treedef, &pwr->readers);
|
||||
if (m->acknack_xevent == NULL)
|
||||
{
|
||||
m = ut_avlFindMin (&pwr_readers_treedef, &pwr->readers);
|
||||
m = ddsrt_avl_find_min (&pwr_readers_treedef, &pwr->readers);
|
||||
while (m && m->acknack_xevent == NULL)
|
||||
m = ut_avlFindSucc (&pwr_readers_treedef, &pwr->readers, m);
|
||||
m = ddsrt_avl_find_succ (&pwr_readers_treedef, &pwr->readers, m);
|
||||
}
|
||||
}
|
||||
else if (seq < nn_reorder_next_seq (pwr->reorder))
|
||||
{
|
||||
/* Check out-of-sync readers -- should add a bit to cheaply test
|
||||
whether there are any (usually there aren't) */
|
||||
m = ut_avlFindMin (&pwr_readers_treedef, &pwr->readers);
|
||||
m = ddsrt_avl_find_min (&pwr_readers_treedef, &pwr->readers);
|
||||
while (m)
|
||||
{
|
||||
if ((m->in_sync == PRMSS_OUT_OF_SYNC) && m->acknack_xevent != NULL && nn_reorder_wantsample (m->u.not_in_sync.reorder, seq))
|
||||
|
@ -1414,7 +1414,7 @@ static int handle_HeartbeatFrag (struct receiver_state *rst, UNUSED_ARG(nn_etime
|
|||
reader to decide which fragments to nack */
|
||||
break;
|
||||
}
|
||||
m = ut_avlFindSucc (&pwr_readers_treedef, &pwr->readers, m);
|
||||
m = ddsrt_avl_find_succ (&pwr_readers_treedef, &pwr->readers, m);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1495,7 +1495,7 @@ static int handle_NackFrag (struct receiver_state *rst, nn_etime_t tnow, const N
|
|||
}
|
||||
|
||||
ddsrt_mutex_lock (&wr->e.lock);
|
||||
if ((rn = ut_avlLookup (&wr_readers_treedef, &wr->readers, &src)) == NULL)
|
||||
if ((rn = ddsrt_avl_lookup (&wr_readers_treedef, &wr->readers, &src)) == NULL)
|
||||
{
|
||||
DDS_TRACE(" %x:%x:%x:%x -> %x:%x:%x:%x not a connection", PGUID (src), PGUID (dst));
|
||||
goto out;
|
||||
|
@ -1737,7 +1737,7 @@ static int handle_Gap (struct receiver_state *rst, nn_etime_t tnow, struct nn_rm
|
|||
lease_renew (ddsrt_atomic_ldvoidp (&pwr->c.proxypp->lease), tnow);
|
||||
|
||||
ddsrt_mutex_lock (&pwr->e.lock);
|
||||
if ((wn = ut_avlLookup (&pwr_readers_treedef, &pwr->readers, &dst)) == NULL)
|
||||
if ((wn = ddsrt_avl_lookup (&pwr_readers_treedef, &pwr->readers, &dst)) == NULL)
|
||||
{
|
||||
DDS_TRACE("%x:%x:%x:%x -> %x:%x:%x:%x not a connection)", PGUID (src), PGUID (dst));
|
||||
ddsrt_mutex_unlock (&pwr->e.lock);
|
||||
|
@ -2069,11 +2069,11 @@ retry:
|
|||
we fall back to using the GUIDs so that we can deliver all
|
||||
samples we received from it. As writer being deleted any
|
||||
reliable samples that are rejected are simply discarded. */
|
||||
ut_avlIter_t it;
|
||||
ddsrt_avl_iter_t it;
|
||||
struct pwr_rd_match *m;
|
||||
ddsrt_mutex_unlock (&pwr->rdary.rdary_lock);
|
||||
if (!pwr_locked) ddsrt_mutex_lock (&pwr->e.lock);
|
||||
for (m = ut_avlIterFirst (&pwr_readers_treedef, &pwr->readers, &it); m != NULL; m = ut_avlIterNext (&it))
|
||||
for (m = ddsrt_avl_iter_first (&pwr_readers_treedef, &pwr->readers, &it); m != NULL; m = ddsrt_avl_iter_next (&it))
|
||||
{
|
||||
struct reader *rd;
|
||||
if ((rd = ephash_lookup_reader_guid (&m->rd_guid)) != NULL)
|
||||
|
@ -2138,7 +2138,7 @@ static void clean_defrag (struct proxy_writer *pwr)
|
|||
if (pwr->n_readers_out_of_sync > 0)
|
||||
{
|
||||
struct pwr_rd_match *wn;
|
||||
for (wn = ut_avlFindMin (&pwr_readers_treedef, &pwr->readers); wn != NULL; wn = ut_avlFindSucc (&pwr_readers_treedef, &pwr->readers, wn))
|
||||
for (wn = ddsrt_avl_find_min (&pwr_readers_treedef, &pwr->readers); wn != NULL; wn = ddsrt_avl_find_succ (&pwr_readers_treedef, &pwr->readers, wn))
|
||||
{
|
||||
if (wn->in_sync == PRMSS_OUT_OF_SYNC)
|
||||
{
|
||||
|
@ -2199,7 +2199,7 @@ static void handle_regular (struct receiver_state *rst, nn_etime_t tnow, struct
|
|||
return;
|
||||
}
|
||||
|
||||
if (ut_avlIsEmpty (&pwr->readers) || pwr->local_matching_inprogress)
|
||||
if (ddsrt_avl_is_empty (&pwr->readers) || pwr->local_matching_inprogress)
|
||||
{
|
||||
ddsrt_mutex_unlock (&pwr->e.lock);
|
||||
DDS_TRACE(" %x:%x:%x:%x -> %x:%x:%x:%x: no readers", PGUID (pwr->e.guid), PGUID (dst));
|
||||
|
@ -2274,9 +2274,9 @@ static void handle_regular (struct receiver_state *rst, nn_etime_t tnow, struct
|
|||
writer may have become in sync with the proxy writer and the
|
||||
writer; those catching up with TL all by themselves go through
|
||||
the "TOO_OLD" path below. */
|
||||
ut_avlIter_t it;
|
||||
ddsrt_avl_iter_t it;
|
||||
struct pwr_rd_match *wn;
|
||||
for (wn = ut_avlIterFirst (&pwr_readers_treedef, &pwr->readers, &it); wn != NULL; wn = ut_avlIterNext (&it))
|
||||
for (wn = ddsrt_avl_iter_first (&pwr_readers_treedef, &pwr->readers, &it); wn != NULL; wn = ddsrt_avl_iter_next (&it))
|
||||
if (wn->in_sync == PRMSS_TLCATCHUP)
|
||||
maybe_set_reader_in_sync (pwr, wn, sampleinfo->seq);
|
||||
}
|
||||
|
@ -2286,7 +2286,7 @@ static void handle_regular (struct receiver_state *rst, nn_etime_t tnow, struct
|
|||
struct pwr_rd_match *wn;
|
||||
struct nn_rsample *rsample_dup = NULL;
|
||||
int reuse_rsample_dup = 0;
|
||||
for (wn = ut_avlFindMin (&pwr_readers_treedef, &pwr->readers); wn != NULL; wn = ut_avlFindSucc (&pwr_readers_treedef, &pwr->readers, wn))
|
||||
for (wn = ddsrt_avl_find_min (&pwr_readers_treedef, &pwr->readers); wn != NULL; wn = ddsrt_avl_find_succ (&pwr_readers_treedef, &pwr->readers, wn))
|
||||
{
|
||||
nn_reorder_result_t rres2;
|
||||
if (wn->in_sync != PRMSS_OUT_OF_SYNC || sampleinfo->seq > wn->u.not_in_sync.end_of_out_of_sync_seq)
|
||||
|
@ -2380,7 +2380,7 @@ static void drop_oversize (struct receiver_state *rst, struct nn_rmsg *rmsg, con
|
|||
dst.entityid = msg->readerId;
|
||||
|
||||
ddsrt_mutex_lock (&pwr->e.lock);
|
||||
wn = ut_avlLookup (&pwr_readers_treedef, &pwr->readers, &dst);
|
||||
wn = ddsrt_avl_lookup (&pwr_readers_treedef, &pwr->readers, &dst);
|
||||
gap_was_valuable = handle_one_gap (pwr, wn, sampleinfo->seq, sampleinfo->seq+1, gap, &refc_adjust);
|
||||
nn_fragchain_adjust_refcount (gap, refc_adjust);
|
||||
ddsrt_mutex_unlock (&pwr->e.lock);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "dds/ddsrt/heap.h"
|
||||
#include "dds/ddsrt/sync.h"
|
||||
|
||||
#include "dds/util/ut_avl.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
#include "dds/ddsi/q_entity.h"
|
||||
#include "dds/ddsi/q_addrset.h"
|
||||
#include "dds/ddsi/q_xmsg.h"
|
||||
|
@ -51,12 +51,12 @@
|
|||
|
||||
static const struct wr_prd_match *root_rdmatch (const struct writer *wr)
|
||||
{
|
||||
return ut_avlRoot (&wr_readers_treedef, &wr->readers);
|
||||
return ddsrt_avl_root (&wr_readers_treedef, &wr->readers);
|
||||
}
|
||||
|
||||
static int have_reliable_subs (const struct writer *wr)
|
||||
{
|
||||
if (ut_avlIsEmpty (&wr->readers) || root_rdmatch (wr)->min_seq == MAX_SEQ_NUMBER)
|
||||
if (ddsrt_avl_is_empty (&wr->readers) || root_rdmatch (wr)->min_seq == MAX_SEQ_NUMBER)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
|
@ -152,7 +152,7 @@ struct nn_xmsg *writer_hbcontrol_create_heartbeat (struct writer *wr, const stru
|
|||
/* out of memory at worst slows down traffic */
|
||||
return NULL;
|
||||
|
||||
if (ut_avlIsEmpty (&wr->readers) || wr->num_reliable_readers == 0)
|
||||
if (ddsrt_avl_is_empty (&wr->readers) || wr->num_reliable_readers == 0)
|
||||
{
|
||||
/* Not really supposed to come here, at least not for the first
|
||||
case. Secondly, there really seems to be little use for
|
||||
|
@ -192,9 +192,9 @@ struct nn_xmsg *writer_hbcontrol_create_heartbeat (struct writer *wr, const stru
|
|||
DDS_TRACE("unicasting to prd %x:%x:%x:%x ", PGUID (*prd_guid));
|
||||
DDS_TRACE("(rel-prd %d seq-eq-max %d seq %"PRId64" maxseq %"PRId64")\n",
|
||||
wr->num_reliable_readers,
|
||||
ut_avlIsEmpty (&wr->readers) ? -1 : root_rdmatch (wr)->num_reliable_readers_where_seq_equals_max,
|
||||
ddsrt_avl_is_empty (&wr->readers) ? -1 : root_rdmatch (wr)->num_reliable_readers_where_seq_equals_max,
|
||||
wr->seq,
|
||||
ut_avlIsEmpty (&wr->readers) ? (seqno_t) -1 : root_rdmatch (wr)->max_seq);
|
||||
ddsrt_avl_is_empty (&wr->readers) ? (seqno_t) -1 : root_rdmatch (wr)->max_seq);
|
||||
|
||||
if (prd_guid == NULL)
|
||||
{
|
||||
|
@ -312,8 +312,8 @@ struct nn_xmsg *writer_hbcontrol_piggyback (struct writer *wr, const struct whc_
|
|||
PGUID (wr->e.guid),
|
||||
*hbansreq ? "" : " final",
|
||||
(hbc->tsched.v == T_NEVER) ? POS_INFINITY_DOUBLE : (double) (hbc->tsched.v - tnow.v) / 1e9,
|
||||
ut_avlIsEmpty (&wr->readers) ? -1 : root_rdmatch (wr)->min_seq,
|
||||
ut_avlIsEmpty (&wr->readers) || root_rdmatch (wr)->all_have_replied_to_hb ? "" : "!",
|
||||
ddsrt_avl_is_empty (&wr->readers) ? -1 : root_rdmatch (wr)->min_seq,
|
||||
ddsrt_avl_is_empty (&wr->readers) || root_rdmatch (wr)->all_have_replied_to_hb ? "" : "!",
|
||||
whcst->max_seq, READ_SEQ_XMIT(wr));
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#include "dds/ddsrt/heap.h"
|
||||
#include "dds/ddsrt/sync.h"
|
||||
|
||||
#include "dds/util/ut_avl.h"
|
||||
#include "dds/util/ut_fibheap.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
#include "dds/ddsrt/fibheap.h"
|
||||
|
||||
#include "dds/ddsi/q_time.h"
|
||||
#include "dds/ddsi/q_log.h"
|
||||
|
@ -70,7 +70,7 @@ enum xeventkind
|
|||
|
||||
struct xevent
|
||||
{
|
||||
ut_fibheapNode_t heapnode;
|
||||
ddsrt_fibheap_node_t heapnode;
|
||||
struct xeventq *evq;
|
||||
nn_mtime_t tsched;
|
||||
enum xeventkind kind;
|
||||
|
@ -133,7 +133,7 @@ struct xevent_nt
|
|||
/* xmsg is self-contained / relies on reference counts */
|
||||
struct nn_xmsg *msg;
|
||||
size_t queued_rexmit_bytes;
|
||||
ut_avlNode_t msg_avlnode;
|
||||
ddsrt_avl_node_t msg_avlnode;
|
||||
} msg_rexmit;
|
||||
struct {
|
||||
/* xmsg is self-contained / relies on reference counts */
|
||||
|
@ -143,8 +143,8 @@ struct xevent_nt
|
|||
};
|
||||
|
||||
struct xeventq {
|
||||
ut_fibheap_t xevents;
|
||||
ut_avlTree_t msg_xevents;
|
||||
ddsrt_fibheap_t xevents;
|
||||
ddsrt_avl_tree_t msg_xevents;
|
||||
struct xevent_nt *non_timed_xmit_list_oldest;
|
||||
struct xevent_nt *non_timed_xmit_list_newest; /* undefined if ..._oldest == NULL */
|
||||
size_t queued_rexmit_bytes;
|
||||
|
@ -164,9 +164,9 @@ static nn_mtime_t earliest_in_xeventq (struct xeventq *evq);
|
|||
static int msg_xevents_cmp (const void *a, const void *b);
|
||||
static int compare_xevent_tsched (const void *va, const void *vb);
|
||||
|
||||
static const ut_avlTreedef_t msg_xevents_treedef = UT_AVL_TREEDEF_INITIALIZER_INDKEY (offsetof (struct xevent_nt, u.msg_rexmit.msg_avlnode), offsetof (struct xevent_nt, u.msg_rexmit.msg), msg_xevents_cmp, 0);
|
||||
static const ddsrt_avl_treedef_t msg_xevents_treedef = DDSRT_AVL_TREEDEF_INITIALIZER_INDKEY (offsetof (struct xevent_nt, u.msg_rexmit.msg_avlnode), offsetof (struct xevent_nt, u.msg_rexmit.msg), msg_xevents_cmp, 0);
|
||||
|
||||
static const ut_fibheapDef_t evq_xevents_fhdef = UT_FIBHEAPDEF_INITIALIZER(offsetof (struct xevent, heapnode), compare_xevent_tsched);
|
||||
static const ddsrt_fibheap_def_t evq_xevents_fhdef = DDSRT_FIBHEAPDEF_INITIALIZER(offsetof (struct xevent, heapnode), compare_xevent_tsched);
|
||||
|
||||
static int compare_xevent_tsched (const void *va, const void *vb)
|
||||
{
|
||||
|
@ -209,21 +209,21 @@ static struct xevent_nt *lookup_msg (struct xeventq *evq, struct nn_xmsg *msg)
|
|||
{
|
||||
assert (nn_xmsg_kind (msg) == NN_XMSG_KIND_DATA_REXMIT);
|
||||
trace_msg ("lookup-msg", msg);
|
||||
return ut_avlLookup (&msg_xevents_treedef, &evq->msg_xevents, msg);
|
||||
return ddsrt_avl_lookup (&msg_xevents_treedef, &evq->msg_xevents, msg);
|
||||
}
|
||||
|
||||
static void remember_msg (struct xeventq *evq, struct xevent_nt *ev)
|
||||
{
|
||||
assert (ev->kind == XEVK_MSG_REXMIT);
|
||||
trace_msg ("remember-msg", ev->u.msg_rexmit.msg);
|
||||
ut_avlInsert (&msg_xevents_treedef, &evq->msg_xevents, ev);
|
||||
ddsrt_avl_insert (&msg_xevents_treedef, &evq->msg_xevents, ev);
|
||||
}
|
||||
|
||||
static void forget_msg (struct xeventq *evq, struct xevent_nt *ev)
|
||||
{
|
||||
assert (ev->kind == XEVK_MSG_REXMIT);
|
||||
trace_msg ("forget-msg", ev->u.msg_rexmit.msg);
|
||||
ut_avlDelete (&msg_xevents_treedef, &evq->msg_xevents, ev);
|
||||
ddsrt_avl_delete (&msg_xevents_treedef, &evq->msg_xevents, ev);
|
||||
}
|
||||
|
||||
static void add_to_non_timed_xmit_list (struct xeventq *evq, struct xevent_nt *ev)
|
||||
|
@ -330,7 +330,7 @@ static void free_xevent_nt (struct xeventq *evq, struct xevent_nt *ev)
|
|||
nn_xmsg_free (ev->u.msg.msg);
|
||||
break;
|
||||
case XEVK_MSG_REXMIT:
|
||||
assert (ut_avlLookup (&msg_xevents_treedef, &evq->msg_xevents, ev->u.msg_rexmit.msg) == NULL);
|
||||
assert (ddsrt_avl_lookup (&msg_xevents_treedef, &evq->msg_xevents, ev->u.msg_rexmit.msg) == NULL);
|
||||
update_rexmit_counts (evq, ev);
|
||||
nn_xmsg_free (ev->u.msg_rexmit.msg);
|
||||
break;
|
||||
|
@ -351,12 +351,12 @@ void delete_xevent (struct xevent *ev)
|
|||
if (ev->tsched.v != T_NEVER)
|
||||
{
|
||||
ev->tsched.v = TSCHED_DELETE;
|
||||
ut_fibheapDecreaseKey (&evq_xevents_fhdef, &evq->xevents, ev);
|
||||
ddsrt_fibheap_decrease_key (&evq_xevents_fhdef, &evq->xevents, ev);
|
||||
}
|
||||
else
|
||||
{
|
||||
ev->tsched.v = TSCHED_DELETE;
|
||||
ut_fibheapInsert (&evq_xevents_fhdef, &evq->xevents, ev);
|
||||
ddsrt_fibheap_insert (&evq_xevents_fhdef, &evq->xevents, ev);
|
||||
}
|
||||
/* TSCHED_DELETE is absolute minimum time, so chances are we need to
|
||||
wake up the thread. The superfluous signal is harmless. */
|
||||
|
@ -384,12 +384,12 @@ int resched_xevent_if_earlier (struct xevent *ev, nn_mtime_t tsched)
|
|||
if (ev->tsched.v != T_NEVER)
|
||||
{
|
||||
ev->tsched = tsched;
|
||||
ut_fibheapDecreaseKey (&evq_xevents_fhdef, &evq->xevents, ev);
|
||||
ddsrt_fibheap_decrease_key (&evq_xevents_fhdef, &evq->xevents, ev);
|
||||
}
|
||||
else
|
||||
{
|
||||
ev->tsched = tsched;
|
||||
ut_fibheapInsert (&evq_xevents_fhdef, &evq->xevents, ev);
|
||||
ddsrt_fibheap_insert (&evq_xevents_fhdef, &evq->xevents, ev);
|
||||
}
|
||||
is_resched = 1;
|
||||
if (tsched.v < tbefore.v)
|
||||
|
@ -435,7 +435,7 @@ static nn_mtime_t earliest_in_xeventq (struct xeventq *evq)
|
|||
{
|
||||
struct xevent *min;
|
||||
ASSERT_MUTEX_HELD (&evq->lock);
|
||||
if ((min = ut_fibheapMin (&evq_xevents_fhdef, &evq->xevents)) != NULL)
|
||||
if ((min = ddsrt_fibheap_min (&evq_xevents_fhdef, &evq->xevents)) != NULL)
|
||||
return min->tsched;
|
||||
else
|
||||
{
|
||||
|
@ -453,7 +453,7 @@ static void qxev_insert (struct xevent *ev)
|
|||
if (ev->tsched.v != T_NEVER)
|
||||
{
|
||||
nn_mtime_t tbefore = earliest_in_xeventq (evq);
|
||||
ut_fibheapInsert (&evq_xevents_fhdef, &evq->xevents, ev);
|
||||
ddsrt_fibheap_insert (&evq_xevents_fhdef, &evq->xevents, ev);
|
||||
if (ev->tsched.v < tbefore.v)
|
||||
ddsrt_cond_signal (&evq->cond);
|
||||
}
|
||||
|
@ -485,8 +485,8 @@ struct xeventq * xeventq_new
|
|||
/* limit to 2GB to prevent overflow (4GB - 64kB should be ok, too) */
|
||||
if (max_queued_rexmit_bytes > 2147483648u)
|
||||
max_queued_rexmit_bytes = 2147483648u;
|
||||
ut_fibheapInit (&evq_xevents_fhdef, &evq->xevents);
|
||||
ut_avlInit (&msg_xevents_treedef, &evq->msg_xevents);
|
||||
ddsrt_fibheap_init (&evq_xevents_fhdef, &evq->xevents);
|
||||
ddsrt_avl_init (&msg_xevents_treedef, &evq->msg_xevents);
|
||||
evq->non_timed_xmit_list_oldest = NULL;
|
||||
evq->non_timed_xmit_list_newest = NULL;
|
||||
evq->terminate = 0;
|
||||
|
@ -540,7 +540,7 @@ void xeventq_free (struct xeventq *evq)
|
|||
{
|
||||
struct xevent *ev;
|
||||
assert (evq->ts == NULL);
|
||||
while ((ev = ut_fibheapExtractMin (&evq_xevents_fhdef, &evq->xevents)) != NULL)
|
||||
while ((ev = ddsrt_fibheap_extract_min (&evq_xevents_fhdef, &evq->xevents)) != NULL)
|
||||
{
|
||||
if (ev->tsched.v == TSCHED_DELETE || ev->kind != XEVK_CALLBACK)
|
||||
free_xevent (evq, ev);
|
||||
|
@ -559,7 +559,7 @@ void xeventq_free (struct xeventq *evq)
|
|||
}
|
||||
while (!non_timed_xmit_list_is_empty(evq))
|
||||
free_xevent_nt (evq, getnext_from_non_timed_xmit_list (evq));
|
||||
assert (ut_avlIsEmpty (&evq->msg_xevents));
|
||||
assert (ddsrt_avl_is_empty (&evq->msg_xevents));
|
||||
ddsrt_cond_destroy (&evq->cond);
|
||||
ddsrt_mutex_destroy (&evq->lock);
|
||||
ddsrt_free (evq);
|
||||
|
@ -636,8 +636,8 @@ static void handle_xevk_heartbeat (struct nn_xpack *xp, struct xevent *ev, nn_mt
|
|||
hbansreq ? "" : " final",
|
||||
msg ? "sent" : "suppressed",
|
||||
(t_next.v == T_NEVER) ? POS_INFINITY_DOUBLE : (double)(t_next.v - tnow.v) / 1e9,
|
||||
ut_avlIsEmpty (&wr->readers) ? (seqno_t) -1 : ((struct wr_prd_match *) ut_avlRootNonEmpty (&wr_readers_treedef, &wr->readers))->min_seq,
|
||||
ut_avlIsEmpty (&wr->readers) || ((struct wr_prd_match *) ut_avlRootNonEmpty (&wr_readers_treedef, &wr->readers))->all_have_replied_to_hb ? "" : "!",
|
||||
ddsrt_avl_is_empty (&wr->readers) ? (seqno_t) -1 : ((struct wr_prd_match *) ddsrt_avl_root_non_empty (&wr_readers_treedef, &wr->readers))->min_seq,
|
||||
ddsrt_avl_is_empty (&wr->readers) || ((struct wr_prd_match *) ddsrt_avl_root_non_empty (&wr_readers_treedef, &wr->readers))->all_have_replied_to_hb ? "" : "!",
|
||||
whcst.max_seq, READ_SEQ_XMIT(wr));
|
||||
resched_xevent_if_earlier (ev, t_next);
|
||||
wr->hbcontrol.tsched = t_next;
|
||||
|
@ -888,7 +888,7 @@ static void handle_xevk_acknack (UNUSED_ARG (struct nn_xpack *xp), struct xevent
|
|||
}
|
||||
|
||||
ddsrt_mutex_lock (&pwr->e.lock);
|
||||
if ((rwn = ut_avlLookup (&pwr_readers_treedef, &pwr->readers, &ev->u.acknack.rd_guid)) == NULL)
|
||||
if ((rwn = ddsrt_avl_lookup (&pwr_readers_treedef, &pwr->readers, &ev->u.acknack.rd_guid)) == NULL)
|
||||
{
|
||||
ddsrt_mutex_unlock (&pwr->e.lock);
|
||||
return;
|
||||
|
@ -1322,7 +1322,7 @@ static void handle_xevents (struct thread_state1 * const ts1, struct xeventq *xe
|
|||
{
|
||||
while (earliest_in_xeventq(xevq).v <= tnow.v)
|
||||
{
|
||||
struct xevent *xev = ut_fibheapExtractMin (&evq_xevents_fhdef, &xevq->xevents);
|
||||
struct xevent *xev = ddsrt_fibheap_extract_min (&evq_xevents_fhdef, &xevq->xevents);
|
||||
if (xev->tsched.v == TSCHED_DELETE)
|
||||
{
|
||||
free_xevent (xevq, xev);
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
#include "dds/ddsrt/heap.h"
|
||||
#include "dds/ddsrt/random.h"
|
||||
|
||||
#include "dds/util/ut_avl.h"
|
||||
#include "dds/util/ut_thread_pool.h"
|
||||
#include "dds/ddsrt/avl.h"
|
||||
#include "dds/ddsrt/thread_pool.h"
|
||||
|
||||
#include "dds/ddsi/q_protocol.h"
|
||||
#include "dds/ddsi/q_xqos.h"
|
||||
|
@ -1340,7 +1340,7 @@ static void nn_xpack_send1_threaded (const nn_locator_t *loc, void * varg)
|
|||
arg->xp = (struct nn_xpack *) varg;
|
||||
arg->loc = loc;
|
||||
ddsrt_atomic_inc32 (&arg->xp->calls);
|
||||
ut_thread_pool_submit (gv.thread_pool, nn_xpack_send1_thread, arg);
|
||||
ddsrt_thread_pool_submit (gv.thread_pool, nn_xpack_send1_thread, arg);
|
||||
}
|
||||
|
||||
static void nn_xpack_send_real (struct nn_xpack * xp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue