Better handle errors
This commit is contained in:
parent
d55ceca275
commit
c4d4288b45
1 changed files with 6 additions and 4 deletions
10
src/proxy.c
10
src/proxy.c
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue