mirror of
https://github.com/3proxy/3proxy.git
synced 2025-02-23 02:25:40 +08:00
Fix for connect back
This commit is contained in:
parent
828e00e668
commit
4d63f957c2
@ -32,6 +32,14 @@ void * threadfunc (void *p) {
|
||||
dolog(param, (unsigned char *)"Connect back accept() failed");
|
||||
continue;
|
||||
}
|
||||
{
|
||||
#ifdef _WIN32
|
||||
unsigned long ul=1;
|
||||
ioctlsocket(param->remsock, FIONBIO, &ul);
|
||||
#else
|
||||
fcntl(param->remsock,F_SETFL,O_NONBLOCK | fcntl(param->remsock,F_GETFL));
|
||||
#endif
|
||||
}
|
||||
#ifndef WITHMAIN
|
||||
param->req = param->sinsr;
|
||||
if(param->srv->acl) param->res = checkACL(param);
|
||||
@ -42,7 +50,7 @@ void * threadfunc (void *p) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if(socksendto(param->remsock, (struct sockaddr*)¶m->sinsr, (unsigned char *)"C", 1, CONNBACK_TO) != 1){
|
||||
if(socksendto(param->remsock, (struct sockaddr*)¶m->sinsr, (unsigned char *)"C", 1, CONNBACK_TO*1000) != 1){
|
||||
dolog(param, (unsigned char *)"Connect back sending command failed");
|
||||
so._closesocket(param->remsock);
|
||||
param->remsock = INVALID_SOCKET;
|
||||
@ -705,7 +713,8 @@ int MODULEMAINFUNC (int argc, char** argv){
|
||||
usleep(SLEEPTIME);
|
||||
continue;
|
||||
}
|
||||
if(sockrecvfrom(new_sock,(struct sockaddr*)&defparam.sincr,buf,1,60) != 1 || *buf!='C') {
|
||||
|
||||
if(sockrecvfrom(new_sock,(struct sockaddr*)&defparam.sincr,buf,1,60*1000) != 1 || *buf!='C') {
|
||||
so._closesocket(new_sock);
|
||||
new_sock = INVALID_SOCKET;
|
||||
usleep(SLEEPTIME);
|
||||
@ -763,8 +772,8 @@ int MODULEMAINFUNC (int argc, char** argv){
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
setopts(new_sock, srv.clisockopts);
|
||||
}
|
||||
size = sizeof(defparam.sincl);
|
||||
if(so._getsockname(new_sock, (struct sockaddr *)&defparam.sincl, &size)){
|
||||
sprintf((char *)buf, "getsockname(): %s", strerror(errno));
|
||||
|
Loading…
Reference in New Issue
Block a user