Fix algo dup2 and algo naive potential bug
This commit is contained in:
parent
3b6fa6e757
commit
a0ca207975
2 changed files with 2 additions and 2 deletions
|
@ -56,7 +56,7 @@ int algo_dup2_on_datagram(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdin
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
// 1. A whole packet has been read, we will find someone to write it
|
// 1. A whole packet has been read, we will find someone to write it
|
||||||
to_fdinfo = g_array_index(cat->socklist, struct evt_core_fdinfo*, i);
|
to_fdinfo = cat->socklist->len > i ? g_array_index(cat->socklist, struct evt_core_fdinfo*, i) : NULL;
|
||||||
if (to_fdinfo == NULL) {
|
if (to_fdinfo == NULL) {
|
||||||
fprintf(stderr, "No fd for cat %s in udp-read.\n", cat->name);
|
fprintf(stderr, "No fd for cat %s in udp-read.\n", cat->name);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -32,7 +32,7 @@ int algo_naive_on_datagram(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdi
|
||||||
|
|
||||||
// 1. A whole packet has been read, we will find someone to write it
|
// 1. A whole packet has been read, we will find someone to write it
|
||||||
struct evt_core_cat* cat = evt_core_get_from_cat (ctx, "tcp-write");
|
struct evt_core_cat* cat = evt_core_get_from_cat (ctx, "tcp-write");
|
||||||
to_fdinfo = g_array_index(cat->socklist, struct evt_core_fdinfo*, 0);
|
to_fdinfo = cat->socklist->len > 0 ? g_array_index(cat->socklist, struct evt_core_fdinfo*, 0) : NULL;
|
||||||
if (to_fdinfo == NULL) {
|
if (to_fdinfo == NULL) {
|
||||||
fprintf(stderr, "No fd for cat %s in udp-read. Dropping packet :( \n", cat->name);
|
fprintf(stderr, "No fd for cat %s in udp-read. Dropping packet :( \n", cat->name);
|
||||||
mv_buffer_wtof (app_ctx, fdinfo);
|
mv_buffer_wtof (app_ctx, fdinfo);
|
||||||
|
|
Loading…
Reference in a new issue