From bc8973b7e9d0cd39afbe4ab6f1325b80447b03ff Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 19 Feb 2019 10:44:22 +0100 Subject: [PATCH] Fix bug and debug algo naive --- src/algo_naive.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/algo_naive.c b/src/algo_naive.c index 571da9e..d1fc775 100644 --- a/src/algo_naive.c +++ b/src/algo_naive.c @@ -165,6 +165,7 @@ void on_tcp_read(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) { // 3. A whole packet has been read, we will find someone to write it sprintf(url, "udp:write:127.0.0.1:%d", bp->ip.ap.str.port); + printf("wil forwared to: %s\n", url); to_fdinfo = evt_core_get_from_url (ctx, url); if (to_fdinfo == NULL) goto co_error; @@ -228,6 +229,8 @@ void on_udp_read(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) { mv_buffer_rtow (app_ctx, fdinfo, to_fdinfo, bp); on_tcp_write(ctx, to_fdinfo); + return; + co_error: perror("Failed to UDP read"); exit(EXIT_FAILURE); @@ -251,6 +254,7 @@ void on_udp_write (struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) { mv_buffer_wtor(app_ctx, fdinfo, bp); notify_read(ctx, app_ctx); + return; co_error: perror("Failed to UDP write"); exit(EXIT_FAILURE);