mirror of
https://github.com/hufrea/byedpi.git
synced 2024-11-20 04:22:29 +00:00
Replace perror calls, remove io from conev.c
This commit is contained in:
parent
97fb56955d
commit
86217408fc
10
conev.c
10
conev.c
@ -1,10 +1,8 @@
|
||||
#define CONEV_H
|
||||
#include <conev.h>
|
||||
#include <error.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
struct poolhd *init_pool(int count)
|
||||
@ -19,7 +17,6 @@ struct poolhd *init_pool(int count)
|
||||
#ifndef NOEPOLL
|
||||
int efd = epoll_create(count);
|
||||
if (efd < 0) {
|
||||
uniperror("epoll_create");
|
||||
free(pool);
|
||||
return 0;
|
||||
}
|
||||
@ -149,7 +146,6 @@ struct eval *next_event(struct poolhd *pool, int *offs, int *type)
|
||||
if (i < 0) {
|
||||
i = (epoll_wait(pool->efd, pool->pevents, pool->max, -1) - 1);
|
||||
if (i < 0) {
|
||||
uniperror("epoll_wait");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -169,10 +165,7 @@ int mod_etype(struct poolhd *pool, struct eval *val, int type, char add)
|
||||
else
|
||||
ev.events &= ~type;
|
||||
val->events = ev.events;
|
||||
int s = epoll_ctl(pool->efd, EPOLL_CTL_MOD, val->fd, &ev);
|
||||
if (s)
|
||||
uniperror("epoll_ctl");
|
||||
return s;
|
||||
return epoll_ctl(pool->efd, EPOLL_CTL_MOD, val->fd, &ev);
|
||||
}
|
||||
|
||||
#else
|
||||
@ -181,7 +174,6 @@ struct eval *next_event(struct poolhd *pool, int *offs, int *typel)
|
||||
for (int i = *offs; ; i--) {
|
||||
if (i < 0) {
|
||||
if (poll(pool->pevents, pool->count, -1) <= 0) {
|
||||
uniperror("poll");
|
||||
return 0;
|
||||
}
|
||||
i = pool->count - 1;
|
||||
|
6
desync.c
6
desync.c
@ -98,7 +98,7 @@ int fake_attack(int sfd, char *buffer,
|
||||
break;
|
||||
}
|
||||
if (_sendfile(sfd, ffd, 0, pos) < 0) {
|
||||
perror("sendfile");
|
||||
uniperror("sendfile");
|
||||
break;
|
||||
}
|
||||
struct timespec delay = {
|
||||
@ -111,7 +111,7 @@ int fake_attack(int sfd, char *buffer,
|
||||
break;
|
||||
}
|
||||
if (send(sfd, buffer + pos, n - pos, 0) < 0) {
|
||||
perror("send");
|
||||
uniperror("send");
|
||||
break;
|
||||
}
|
||||
status = 0;
|
||||
@ -165,7 +165,7 @@ int desync(int sfd, char *buffer, size_t bfsize,
|
||||
if (type == IS_HTTP && params.mod_http) {
|
||||
LOG(LOG_S, "modify HTTP: n=%ld\n", n);
|
||||
if (mod_http(buffer, n, params.mod_http)) {
|
||||
fprintf(stderr, "mod http error\n");
|
||||
LOG(LOG_E, "mod http error\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
3
proxy.c
3
proxy.c
@ -456,6 +456,7 @@ static inline int on_connect(struct poolhd *pool, struct eval *val,
|
||||
return -1;
|
||||
}
|
||||
if (mod_etype(pool, val, POLLOUT, 0)) {
|
||||
uniperror("mod_etype");
|
||||
return -1;
|
||||
}
|
||||
val->type = EV_TUNNEL;
|
||||
@ -503,6 +504,7 @@ static inline int on_tunnel(struct poolhd *pool, struct eval *val,
|
||||
|
||||
if (mod_etype(pool, val, POLLIN, 1) ||
|
||||
mod_etype(pool, pair, POLLOUT, 0)) {
|
||||
uniperror("mod_etype");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -534,6 +536,7 @@ static inline int on_tunnel(struct poolhd *pool, struct eval *val,
|
||||
|
||||
if (mod_etype(pool, val, POLLIN, 0) ||
|
||||
mod_etype(pool, pair, POLLOUT, 1)) {
|
||||
uniperror("mod_etype");
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user