mirror of
https://github.com/3proxy/3proxy.git
synced 2025-02-23 10:35:40 +08:00
better EINTR handling
This commit is contained in:
parent
40d03b8a4a
commit
443a4c02d0
@ -47,7 +47,7 @@ int socksendto(SOCKET sock, struct sockaddr_in * sin, unsigned char * buf, int b
|
||||
if(res < 1) break;
|
||||
res = so._sendto(sock, buf + sent, bufsize - sent, 0, (struct sockaddr *)sin, sizeof(struct sockaddr_in));
|
||||
if(res < 0) {
|
||||
if(errno != EAGAIN) break;
|
||||
if(errno != EAGAIN && errno != EINTR) break;
|
||||
continue;
|
||||
}
|
||||
sent += res;
|
||||
|
@ -130,7 +130,8 @@ int sockmap(struct clientparam * param, int timeo){
|
||||
}
|
||||
res = so._sendto(param->clisock, param->srvbuf + param->srvoffset,(!param->waitserver || ((unsigned)param->waitserver - received) > (param->srvinbuf - param->srvoffset))? param->srvinbuf - param->srvoffset : param->waitserver - received, 0, (struct sockaddr*)¶m->sinc, sasize);
|
||||
if(res < 0) {
|
||||
if(errno != EAGAIN) return 96;
|
||||
if(errno != EAGAIN && errno != EINTR) return 96;
|
||||
if(errno == EINTR) usleep(SLEEPTIME);
|
||||
continue;
|
||||
}
|
||||
param->srvoffset += res;
|
||||
@ -155,7 +156,8 @@ int sockmap(struct clientparam * param, int timeo){
|
||||
}
|
||||
res = so._sendto(param->remsock, param->clibuf + param->clioffset, (!param->waitclient || ((unsigned)param->waitclient - sent) > (param->cliinbuf - param->clioffset))? param->cliinbuf - param->clioffset : param->waitclient - sent, 0, (struct sockaddr*)¶m->sins, sasize);
|
||||
if(res < 0) {
|
||||
if(errno != EAGAIN) return 97;
|
||||
if(errno != EAGAIN && errno != EINTR) return 97;
|
||||
if(errno == EINTR) usleep(SLEEPTIME);
|
||||
continue;
|
||||
}
|
||||
param->clioffset += res;
|
||||
@ -180,7 +182,8 @@ int sockmap(struct clientparam * param, int timeo){
|
||||
}
|
||||
else {
|
||||
if (res < 0){
|
||||
if( errno != EAGAIN) return (94);
|
||||
if(errno != EAGAIN && errno != EINTR) return 94;
|
||||
if(errno == EINTR) usleep(SLEEPTIME);
|
||||
continue;
|
||||
}
|
||||
param->cliinbuf += res;
|
||||
@ -210,7 +213,8 @@ int sockmap(struct clientparam * param, int timeo){
|
||||
}
|
||||
else {
|
||||
if (res < 0){
|
||||
if( errno != EAGAIN) return (93);
|
||||
if(errno != EAGAIN && errno != EINTR) return 93;
|
||||
if(errno == EINTR) usleep(SLEEPTIME);
|
||||
continue;
|
||||
}
|
||||
param->srvinbuf += res;
|
||||
|
Loading…
Reference in New Issue
Block a user