fix sockssend

This commit is contained in:
z3APA3A 2020-12-03 17:50:49 +03:00
parent baed6039c8
commit e6a4e1d6e7

View File

@ -15,15 +15,14 @@ int socksend(SOCKET sock, char * buf, int bufsize, int to){
fds.fd = sock; fds.fd = sock;
do { do {
res = so._send(sock, (char *)buf + sent, bufsize - sent, 0); res = so._send(sock, (char *)buf + sent, bufsize - sent, 0);
if(res < 0) { if(res <= 0) {
if(errno == EAGAIN || errno == EINTR) continue; if(errno != EAGAIN && errno != EINTR) break;
break;
fds.events = POLLOUT; fds.events = POLLOUT;
fds.fd = sock;
if(conf.timetoexit) return sent; if(conf.timetoexit) return sent;
res = so._poll(&fds, 1, to*1000); res = so._poll(&fds, 1, to*1000);
if(res < 0 && (errno == EAGAIN || errno == EINTR)) continue; if(res < 1 && errno != EAGAIN && errno != EINTR) break;
if(res < 1) break; continue;
res = 0;
} }
sent += res; sent += res;
} while (sent < bufsize); } while (sent < bufsize);