Fix socket draining / lingering

This commit is contained in:
Vladimir Dubrovin committed 2026-10-11 19:04:53 +03:00
1 parent baea44477e
commit f128fd2aa7
5 files changed
+76 -7

No files matched your search

+5 -1
View File
@@ -387,7 +387,6 @@ int
return shutdown(s, how);
}
int WINAPI def_closesocket(void* state, SOCKET s){
usleep(SLEEPTIME);
return closesocket(s);
}
#else
@@ -715,7 +714,9 @@ int doconnect(struct clientparam * param){
if(param->srv->so._getpeername(param->sostate, param->remsock, (struct sockaddr *)&param->sinsr, &size)==-1) {return (14);}
}
else {
#ifndef _WIN32
struct linger lg = {1,conf.timeouts[LINGER_TO]};
#endif
int tries = RANGETRIES;
if(SAISNULL(&param->sinsr)){
@@ -747,7 +748,10 @@ int doconnect(struct clientparam * param){
*SAPORT(&param->sinsl) = 0;
setopts(param->remsock, param->srv->srvsockopts);
#ifndef _WIN32
/* not on Windows, see the accepting side in proxymain.c */
param->srv->so._setsockopt(param->sostate, param->remsock, SOL_SOCKET, SO_LINGER, (char *)&lg, sizeof(lg));
#endif
if(extbindtodevice(param, param->remsock)) return 12;
#ifdef WITH_UN
if(*SAFAMILY(&param->sinsl) != AF_UNIX)