*next_update = diff;
}
-static int peer_hash_cmp(const void *f, const void *s)
+static bool peer_hash_cmp(const void *f, const void *s)
{
const struct pkat *p1 = f;
const struct pkat *p2 = s;
+
return p1->peer == p2->peer;
}
pthread_cond_init(peerhash_cond, &attrs);
pthread_condattr_destroy(&attrs);
-#ifdef GNU_LINUX
- pthread_setname_np(fpt->thread, "bgpd_ka");
-#elif defined(OPEN_BSD)
- pthread_set_name_np(fpt->thread, "bgpd_ka");
-#endif
+ frr_pthread_set_name(fpt, NULL, "bgpd_ka");
/* initialize peer hashtable */
peerhash = hash_create_size(2048, peer_hash_key, peer_hash_cmp, NULL);
if (CHECK_FLAG(peer->thread_flags, PEER_THREAD_KEEPALIVES_ON))
return;
- struct frr_pthread *fpt = frr_pthread_get(PTHREAD_KEEPALIVES);
+ struct frr_pthread *fpt = bgp_pth_ka;
assert(fpt->running);
/* placeholder bucket data to use for fast key lookups */
static struct pkat holder = {0};
- if (!peerhash_mtx) {
- zlog_warn("%s: call bgp_keepalives_init() first", __func__);
- return;
- }
+ /*
+ * We need to ensure that bgp_keepalives_init was called first
+ */
+ assert(peerhash_mtx);
pthread_mutex_lock(peerhash_mtx);
{
if (!CHECK_FLAG(peer->thread_flags, PEER_THREAD_KEEPALIVES_ON))
return;
- struct frr_pthread *fpt = frr_pthread_get(PTHREAD_KEEPALIVES);
+ struct frr_pthread *fpt = bgp_pth_ka;
assert(fpt->running);
/* placeholder bucket data to use for fast key lookups */
static struct pkat holder = {0};
- if (!peerhash_mtx) {
- zlog_warn("%s: call bgp_keepalives_init() first", __func__);
- return;
- }
+ /*
+ * We need to ensure that bgp_keepalives_init was called first
+ */
+ assert(peerhash_mtx);
pthread_mutex_lock(peerhash_mtx);
{