Better logging

This commit is contained in:
Quentin Dufour 2019-03-27 18:11:05 +01:00
parent c6f7199bf6
commit e15e15325c
2 changed files with 6 additions and 4 deletions

View file

@ -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 // 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 = bp->ip.ap.str.bitfield;
rr->my_links_ver = bp->ip.ap.str.id; 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 // 2. If packet arrived too late, we discard it

View file

@ -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) { 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 // 1. Update old category
for (int i = 0; i < fdinfo->cat->socklist->len; i++) { 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 // 5. Add file descriptor to epoll
add_fd_to_epoll(ctx->epollfd, user_data->fd, cat->flags); 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 // 6. Ensure that events arrived before epoll registering are handled
fdinfo->cat->cb(ctx, fdinfo); 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); struct evt_core_fdinfo* fdinfo = g_hash_table_lookup (ctx->socklist, &fd);
if (fdinfo == NULL) return NULL; if (fdinfo == NULL) return NULL;
cat = fdinfo->cat; 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 // 2. Update category
for (int i = 0; i < cat->socklist->len; i++) { for (int i = 0; i < cat->socklist->len; i++) {