Fix bug and debug algo naive

This commit is contained in:
Quentin Dufour 2019-02-19 10:44:22 +01:00
parent 349909ff47
commit bc8973b7e9

View file

@ -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);