|
@@ -123,17 +123,17 @@ int sockmap(struct clientparam * param, int timeo, int usesplice){
|
|
|
if(action != PASS) RETURN(19);
|
|
if(action != PASS) RETURN(19);
|
|
|
|
|
|
|
|
while(
|
|
while(
|
|
|
- ((!CLIENTTERM) && (inserverbuf
|
|
|
|
|
|
|
+ ((!CLIENTTERM) && fromserver && (inserverbuf
|
|
|
#ifdef WITHSPLICE
|
|
#ifdef WITHSPLICE
|
|
|
|| inserverpipe
|
|
|| inserverpipe
|
|
|
#endif
|
|
#endif
|
|
|
- || (!SERVERTERM && fromserver)))
|
|
|
|
|
|
|
+ || (!SERVERTERM )))
|
|
|
||
|
|
||
|
|
|
- ((!SERVERTERM) && (inclientbuf
|
|
|
|
|
|
|
+ ((!SERVERTERM) && fromclient && (inclientbuf
|
|
|
#ifdef WITHSPLICE
|
|
#ifdef WITHSPLICE
|
|
|
|| inclientpipe
|
|
|| inclientpipe
|
|
|
#endif
|
|
#endif
|
|
|
- || (!CLIENTTERM && fromclient)))
|
|
|
|
|
|
|
+ || (!CLIENTTERM )))
|
|
|
){
|
|
){
|
|
|
|
|
|
|
|
|
|
|
|
@@ -316,8 +316,11 @@ 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;
|
|
|
|
|
+ if(res == 0) {
|
|
|
|
|
+ CLIENTTERM = 1;
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
#ifdef WITHLOG
|
|
#ifdef WITHLOG
|
|
@@ -340,8 +343,11 @@ 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;
|
|
|
|
|
+ if(res == 0 || !errno) {
|
|
|
|
|
+ SERVERTERM = 1;
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
#ifdef WITHLOG
|
|
#ifdef WITHLOG
|
|
@@ -375,8 +381,11 @@ 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(res == 0 || !errno)CLIENTTERM = 1;
|
|
|
|
|
FROMCLIENT = 0;
|
|
FROMCLIENT = 0;
|
|
|
|
|
+ if(res == 0){
|
|
|
|
|
+ CLIENTTERM = 1;
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
#ifdef WITHLOG
|
|
#ifdef WITHLOG
|
|
@@ -397,8 +406,11 @@ 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(res == 0 || !errno) SERVERTERM = 1;
|
|
|
|
|
FROMSERVER = 0;
|
|
FROMSERVER = 0;
|
|
|
|
|
+ if(res == 0) {
|
|
|
|
|
+ SERVERTERM = 1;
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
#ifdef WITHLOG
|
|
#ifdef WITHLOG
|