diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-10-13 08:34:48 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-12-21 20:26:11 -0500 |
| commit | 040d86ade76e3791ea42d25a2b0261791e2f579b (patch) | |
| tree | d02796eb163ab033e070eda158c17a38f2538b4e /pimd/pimd.c | |
| parent | 0f5889897125e5ba5d62bc1151cec3c7d6c6d404 (diff) | |
pimd: Create channel_oil hash for quicker lookup
When looking up the channel_oil use a hash
to find it. Keep the list around for quick
walks of the channel oils.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pimd.c')
| -rw-r--r-- | pimd/pimd.c | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/pimd/pimd.c b/pimd/pimd.c index 82ecdc9fc5..1608f2d07e 100644 --- a/pimd/pimd.c +++ b/pimd/pimd.c @@ -52,7 +52,6 @@ int qpim_mroute_socket_fd = -1; int64_t qpim_mroute_socket_creation = 0; /* timestamp of creation */ struct thread *qpim_mroute_socket_reader = NULL; int qpim_mroute_oif_highest_vif_index = -1; -struct list *qpim_channel_oil_list = NULL; int qpim_t_periodic = PIM_DEFAULT_T_PERIODIC; /* Period between Join/Prune Messages */ struct zclient *qpim_zclient_update = NULL; struct pim_assert_metric qpim_infinite_assert_metric; @@ -82,8 +81,7 @@ static void pim_free() { pim_ssmpingd_destroy(); - if (qpim_channel_oil_list) - list_free(qpim_channel_oil_list); + pim_oil_terminate (); pim_upstream_terminate (); @@ -96,24 +94,6 @@ static void pim_free() pim_route_map_terminate(); } -static int -pim_channel_oil_compare (struct channel_oil *c1, struct channel_oil *c2) -{ - if (ntohl(c1->oil.mfcc_mcastgrp.s_addr) < ntohl(c2->oil.mfcc_mcastgrp.s_addr)) - return -1; - - if (ntohl(c1->oil.mfcc_mcastgrp.s_addr) > ntohl(c2->oil.mfcc_mcastgrp.s_addr)) - return 1; - - if (ntohl(c1->oil.mfcc_origin.s_addr) < ntohl(c2->oil.mfcc_origin.s_addr)) - return -1; - - if (ntohl(c1->oil.mfcc_origin.s_addr) > ntohl(c2->oil.mfcc_origin.s_addr)) - return 1; - - return 0; -} - void pim_init() { srandom(time(NULL)); @@ -130,14 +110,7 @@ void pim_init() return; } - qpim_channel_oil_list = list_new(); - if (!qpim_channel_oil_list) { - zlog_err("%s %s: failure: channel_oil_list=list_new()", - __FILE__, __PRETTY_FUNCTION__); - return; - } - qpim_channel_oil_list->del = (void (*)(void *)) pim_channel_oil_free; - qpim_channel_oil_list->cmp = (int (*)(void *, void *)) pim_channel_oil_compare; + pim_oil_init (); pim_upstream_init (); |
