mirror of
https://github.com/3proxy/3proxy.git
synced 2025-02-24 02:55:40 +08:00
Better handle socket closing
This commit is contained in:
parent
c63392f1ea
commit
6092fd640f
@ -314,6 +314,7 @@ log("read from client to pipe");
|
|||||||
#ifdef WITHLOG
|
#ifdef WITHLOG
|
||||||
log("read failed");
|
log("read failed");
|
||||||
#endif
|
#endif
|
||||||
|
if(res == 0 || !errno) CLIENTTERM = 1;
|
||||||
FROMCLIENT = TOCLIENTPIPE = 0;
|
FROMCLIENT = TOCLIENTPIPE = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -337,6 +338,7 @@ log("read from server to pipe\n");
|
|||||||
log("splice finished\n");
|
log("splice finished\n");
|
||||||
#endif
|
#endif
|
||||||
if(res <= 0) {
|
if(res <= 0) {
|
||||||
|
if(res == 0 || !errno) SERVERTERM = 1;
|
||||||
FROMSERVER = TOSERVERPIPE = 0;
|
FROMSERVER = TOSERVERPIPE = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -371,7 +373,7 @@ log("read from client to buf");
|
|||||||
sasize = sizeof(param->sincr);
|
sasize = sizeof(param->sincr);
|
||||||
res = so._recvfrom(param->clisock, (char *)param->clibuf + param->cliinbuf, (int)MIN((uint64_t)param->clibufsize - param->cliinbuf, fromclient-inclientbuf), 0, (struct sockaddr *)¶m->sincr, &sasize);
|
res = so._recvfrom(param->clisock, (char *)param->clibuf + param->cliinbuf, (int)MIN((uint64_t)param->clibufsize - param->cliinbuf, fromclient-inclientbuf), 0, (struct sockaddr *)¶m->sincr, &sasize);
|
||||||
if(res <= 0) {
|
if(res <= 0) {
|
||||||
if(!errno)CLIENTTERM = 1;
|
if(res == 0 || !errno)CLIENTTERM = 1;
|
||||||
FROMCLIENT = 0;
|
FROMCLIENT = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -393,7 +395,7 @@ log("read from server to buf");
|
|||||||
sasize = sizeof(param->sinsr);
|
sasize = sizeof(param->sinsr);
|
||||||
res = so._recvfrom(param->remsock, (char *)param->srvbuf + param->srvinbuf, (int)MIN((uint64_t)param->srvbufsize - param->srvinbuf, fromserver-inserverbuf), 0, (struct sockaddr *)¶m->sinsr, &sasize);
|
res = so._recvfrom(param->remsock, (char *)param->srvbuf + param->srvinbuf, (int)MIN((uint64_t)param->srvbufsize - param->srvinbuf, fromserver-inserverbuf), 0, (struct sockaddr *)¶m->sinsr, &sasize);
|
||||||
if(res <= 0) {
|
if(res <= 0) {
|
||||||
if(!errno) SERVERTERM = 1;
|
if(res == 0 || !errno) SERVERTERM = 1;
|
||||||
FROMSERVER = 0;
|
FROMSERVER = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user