Fix small bug + debug
This commit is contained in:
parent
9a0c78ebbc
commit
d028638c95
1 changed files with 8 additions and 2 deletions
|
@ -111,6 +111,8 @@ void rr_pkt_register(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo,
|
|||
struct algo_ctx* app_ctx = fdinfo->cat->app_ctx;
|
||||
struct rr_ctx* rr = app_ctx->misc;
|
||||
|
||||
printf("Selected url %s for pkt %d to be queued for delivery\n", fdinfo->url, bp->ip.ap.str.id);
|
||||
|
||||
// 1. Update links I can use thanks to target feedback
|
||||
if (bp->ip.ap.str.id > rr->my_links_ver) {
|
||||
rr->my_links = bp->ip.ap.str.bitfield;
|
||||
|
@ -153,6 +155,8 @@ void rr_deliver(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct
|
|||
struct rr_ctx* rr = app_ctx->misc;
|
||||
char url[255];
|
||||
|
||||
printf("Selected url %s for pkt %d to be delivered\n", fdinfo->url, bp->ip.ap.str.id);
|
||||
|
||||
// 0. We update our cursor
|
||||
rr->recv_id = bp->ip.ap.str.id;
|
||||
|
||||
|
@ -296,12 +300,13 @@ int rr_on_udp_read(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
|
|||
int max = 10;
|
||||
while(1) {
|
||||
if (max-- < 0) break;
|
||||
rr->current_link = (rr->current_link) + 1 % 10;
|
||||
rr->current_link = (rr->current_link + 1) % 10;
|
||||
if (!(rr->my_links & (1 << rr->current_link))) continue;
|
||||
sprintf(url, "tcp:write:127.0.0.1:%d", 7500 + rr->current_link); //@FIXME Hardcoded
|
||||
printf("-- Trying %s\n", url);
|
||||
to_fdinfo = evt_core_get_from_url (ctx, url);
|
||||
if (to_fdinfo != NULL) {
|
||||
printf("Selected url %s\n", url);
|
||||
printf("Selected url %s for pkt %d to be sent on Tor\n", url, bp->ip.ap.str.id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -409,6 +414,7 @@ void algo_rr(struct evt_core_ctx* evt, struct algo_skel* as) {
|
|||
rr->mjit = 200;
|
||||
rr->my_links = 0xff;
|
||||
rr->remote_links = 0xff;
|
||||
rr->sent_id = 1;
|
||||
ctx->misc = rr;
|
||||
for (int i = 0; i < sizeof(ctx->bps) / sizeof(ctx->bps[0]); i++) {
|
||||
g_queue_push_tail(ctx->free_buffer, &(ctx->bps[i]));
|
||||
|
|
Loading…
Reference in a new issue