mirror of
https://github.com/hufrea/byedpi.git
synced 2024-11-29 03:38:55 +03:00
Fix POLLOUT handling
This commit is contained in:
parent
86d725ed66
commit
676227271d
1 changed files with 11 additions and 5 deletions
16
proxy.c
16
proxy.c
|
@ -451,8 +451,10 @@ static inline int on_connect(struct poolhd *pool, struct eval *val,
|
|||
if (e) {
|
||||
return -1;
|
||||
}
|
||||
if (mod_etype(pool, val, POLLOUT, 0)) {
|
||||
return -1;
|
||||
}
|
||||
val->type = EV_TUNNEL;
|
||||
mod_etype(pool, val, POLLOUT, 0);
|
||||
val->pair->type = EV_CONNECT;
|
||||
}
|
||||
else {
|
||||
|
@ -495,8 +497,10 @@ static inline int on_tunnel(struct poolhd *pool, struct eval *val,
|
|||
free(val->tmpbuf);
|
||||
val->tmpbuf = 0;
|
||||
|
||||
mod_etype(pool, val, POLLOUT, 0);
|
||||
mod_etype(pool, val->pair, POLLIN, 1);
|
||||
if (mod_etype(pool, val, POLLIN, 1) ||
|
||||
mod_etype(pool, pair, POLLOUT, 0)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
do {
|
||||
n = recv(val->fd, buffer, bfsize, 0);
|
||||
|
@ -524,8 +528,10 @@ static inline int on_tunnel(struct poolhd *pool, struct eval *val,
|
|||
}
|
||||
memcpy(val->tmpbuf, buffer + sn, val->size);
|
||||
|
||||
mod_etype(pool, val, POLLIN, 0);
|
||||
mod_etype(pool, pair, POLLOUT, 1);
|
||||
if (mod_etype(pool, val, POLLIN, 0) ||
|
||||
mod_etype(pool, pair, POLLOUT, 1)) {
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} while (n == bfsize);
|
||||
|
|
Loading…
Reference in a new issue