From e15e15325c1e8bb910ecb21ab9dec530f2894961 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Wed, 27 Mar 2019 18:11:05 +0100 Subject: [PATCH] Better logging --- src/algo_rr.c | 4 +++- src/evt_core.c | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/algo_rr.c b/src/algo_rr.c index 1c2acb3..82396e8 100644 --- a/src/algo_rr.c +++ b/src/algo_rr.c @@ -143,9 +143,11 @@ void rr_pkt_register(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, } // 1. Update my links I can use thanks to target feedback - if (bp->ip.ap.str.id > rr->my_links_ver) { + if (bp->ip.ap.str.id > rr->my_links_ver && bp->ip.ap.str.bitfield != rr->my_links) { rr->my_links = bp->ip.ap.str.bitfield; rr->my_links_ver = bp->ip.ap.str.id; + printf("Update my links\n"); + show_link_availability (rr); } // 2. If packet arrived too late, we discard it diff --git a/src/evt_core.c b/src/evt_core.c index 1e7b728..0d231d5 100644 --- a/src/evt_core.c +++ b/src/evt_core.c @@ -65,7 +65,7 @@ void evt_core_add_cat(struct evt_core_ctx* ctx, struct evt_core_cat* cat) { } void evt_core_mv_fd(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct evt_core_cat* to_cat) { - printf("Moving fd=%d from cat=%s to cat=%s\n",fdinfo->fd, fdinfo->cat->name, to_cat->name); + //printf("Moving fd=%d from cat=%s to cat=%s\n",fdinfo->fd, fdinfo->cat->name, to_cat->name); // 1. Update old category for (int i = 0; i < fdinfo->cat->socklist->len; i++) { @@ -130,7 +130,7 @@ struct evt_core_fdinfo* evt_core_add_fd(struct evt_core_ctx* ctx, struct evt_cor // 5. Add file descriptor to epoll add_fd_to_epoll(ctx->epollfd, user_data->fd, cat->flags); - printf("Added fd=%d with url=%s in cat=%s\n", fdinfo->fd, fdinfo->url, fdinfo->cat->name); + //printf("Added fd=%d with url=%s in cat=%s\n", fdinfo->fd, fdinfo->url, fdinfo->cat->name); // 6. Ensure that events arrived before epoll registering are handled fdinfo->cat->cb(ctx, fdinfo); @@ -145,7 +145,7 @@ struct evt_core_cat* evt_core_rm_fd(struct evt_core_ctx* ctx, int fd) { struct evt_core_fdinfo* fdinfo = g_hash_table_lookup (ctx->socklist, &fd); if (fdinfo == NULL) return NULL; cat = fdinfo->cat; - printf("Closing fd=%d from cat=%s\n",fdinfo->fd, fdinfo->cat->name); + //printf("Closing fd=%d from cat=%s\n",fdinfo->fd, fdinfo->cat->name); // 2. Update category for (int i = 0; i < cat->socklist->len; i++) {