Better handle errors

This commit is contained in:
Quentin 2019-05-24 17:15:35 +02:00
parent d55ceca275
commit c4d4288b45

View file

@ -58,7 +58,8 @@ int main_on_tcp_read(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
co_error:
perror("Failed to TCP read");
exit(EXIT_FAILURE);
evt_core_rm_fd (ctx, fdinfo->fd);
return 1;
}
int main_on_udp_read(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
@ -81,7 +82,7 @@ int main_on_udp_read(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
co_error:
perror("Failed to UDP read");
exit(EXIT_FAILURE);
return 0;
}
int main_on_tcp_write(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
@ -114,7 +115,8 @@ int main_on_tcp_write(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo)
return 0;
co_error:
perror("Failed to TCP write");
exit(EXIT_FAILURE);
evt_core_rm_fd (ctx, fdinfo->fd);
return 1;
}
int main_on_udp_write (struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
@ -138,7 +140,7 @@ int main_on_udp_write (struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo)
return 0;
co_error:
perror("Failed to UDP write");
exit(EXIT_FAILURE);
return 0;
}
int main_on_err(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {