More debug

This commit is contained in:
Quentin Dufour 2019-02-19 11:00:18 +01:00
parent e7b1b0b3c0
commit 837633e15e

View file

@ -168,6 +168,7 @@ void on_tcp_read(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
printf("wil be forwarded to: %s\n", url); printf("wil be forwarded to: %s\n", url);
to_fdinfo = evt_core_get_from_url (ctx, url); to_fdinfo = evt_core_get_from_url (ctx, url);
if (to_fdinfo == NULL) goto co_error; if (to_fdinfo == NULL) goto co_error;
printf("A full UDP packet has been read from TCP\n");
// 4. We move the buffer and notify the target // 4. We move the buffer and notify the target
mv_buffer_rtow (app_ctx, fdinfo, to_fdinfo, bp); mv_buffer_rtow (app_ctx, fdinfo, to_fdinfo, bp);
@ -193,6 +194,7 @@ void on_tcp_write(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
if (write_res == FDS_ERR) goto co_error; if (write_res == FDS_ERR) goto co_error;
} }
if (bp->mode != BP_READING) return; if (bp->mode != BP_READING) return;
printf("A full UDP packet has been written to TCP\n");
// 3. A whole packet has been written // 3. A whole packet has been written
// Release the buffer and notify // Release the buffer and notify
@ -220,6 +222,7 @@ void on_udp_read(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
read_res = read_packet_from_udp (fdinfo->fd, bp); read_res = read_packet_from_udp (fdinfo->fd, bp);
if (read_res == FDS_ERR) goto co_error; if (read_res == FDS_ERR) goto co_error;
if (bp->mode != BP_WRITING) return; if (bp->mode != BP_WRITING) return;
printf("A full UDP packet has been read from UDP\n");
// 3. A whole packet has been read, we will find someone to write it // 3. A whole packet has been read, we will find someone to write it
sprintf(url, "tcp:write:127.0.0.1:7500"); sprintf(url, "tcp:write:127.0.0.1:7500");
@ -249,6 +252,7 @@ void on_udp_write (struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
write_res = write_packet_to_udp(fdinfo->fd, bp); write_res = write_packet_to_udp(fdinfo->fd, bp);
if (write_res == FDS_ERR) goto co_error; if (write_res == FDS_ERR) goto co_error;
if (bp->mode != BP_READING) return; if (bp->mode != BP_READING) return;
printf("A full UDP packet has been written to UDP\n");
// 3. A whole packet has been written // 3. A whole packet has been written
// Release the buffer and notify // Release the buffer and notify