Prevent deactivation + increase lggging

This commit is contained in:
Quentin Dufour 2019-04-01 10:38:59 +02:00
parent 5897ff3fde
commit 5f0b22b4f0
2 changed files with 4 additions and 4 deletions

View file

@ -400,7 +400,7 @@ int rr_on_tcp_write(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
uint8_t is_rdy = fdinfo->cat->socklist->len >= app_ctx->link_count ? 1 : 0; uint8_t is_rdy = fdinfo->cat->socklist->len >= app_ctx->link_count ? 1 : 0;
if (!app_ctx->is_rdy && is_rdy) printf("=== Our %d requested circuits are now up ===\n", app_ctx->link_count); if (!app_ctx->is_rdy && is_rdy) printf("=== Our %d requested circuits are now up ===\n", app_ctx->link_count);
else if (app_ctx->is_rdy && !is_rdy) printf("=== Only %d/%d circuits are available, results could be biased ===\n", fdinfo->cat->socklist->len, app_ctx->link_count); else if (app_ctx->is_rdy && !is_rdy) printf("=== Only %d/%d circuits are available, results could be biased ===\n", fdinfo->cat->socklist->len, app_ctx->link_count);
app_ctx->is_rdy = is_rdy; app_ctx->is_rdy = app_ctx->is_rdy || is_rdy; // @FIXME prevent deactivation for our tests
// 1. Get current write buffer OR a buffer from the waiting queue OR leave // 1. Get current write buffer OR a buffer from the waiting queue OR leave
if ((bp = get_write_buffer(app_ctx, fdinfo)) == NULL) return 1; if ((bp = get_write_buffer(app_ctx, fdinfo)) == NULL) return 1;

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++) {