mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-22 23:59:41 +08:00
Code cleanup
This commit is contained in:
1 parent
a7cdfa578d
commit
f01c8bfee9
10 files changed
+149
-56
No files matched your search
+8
-1
@@ -22,10 +22,15 @@ int randomizer = 1;
|
||||
|
||||
|
||||
void daemonize(void){
|
||||
if(fork() > 0) {
|
||||
pid_t pid = fork();
|
||||
if(pid > 0) {
|
||||
usleep(SLEEPTIME);
|
||||
_exit(0);
|
||||
}
|
||||
if(pid < 0) {
|
||||
perror("fork()");
|
||||
return;
|
||||
}
|
||||
setsid();
|
||||
}
|
||||
|
||||
@@ -244,6 +249,7 @@ int
|
||||
FD_ZERO(&writefd);
|
||||
FD_ZERO(&oobfd);
|
||||
for(i=0; i<nfds; i++){
|
||||
if(fds[i].fd >= FD_SETSIZE) continue;
|
||||
if((fds[i].events&POLLIN))FD_SET(fds[i].fd, &readfd);
|
||||
if((fds[i].events&POLLOUT))FD_SET(fds[i].fd, &writefd);
|
||||
if((fds[i].events&POLLPRI))FD_SET(fds[i].fd, &oobfd);
|
||||
@@ -252,6 +258,7 @@ int
|
||||
}
|
||||
if((num = select(((int)(maxfd))+1, &readfd, &writefd, &oobfd, &tv)) < 1) return num;
|
||||
for(i=0; i<nfds; i++){
|
||||
if(fds[i].fd >= FD_SETSIZE) continue;
|
||||
if(FD_ISSET(fds[i].fd, &readfd)) fds[i].revents |= POLLIN;
|
||||
if(FD_ISSET(fds[i].fd, &writefd)) fds[i].revents |= POLLOUT;
|
||||
if(FD_ISSET(fds[i].fd, &oobfd)) fds[i].revents |= POLLPRI;
|
||||
|
||||
Reference in new issue
Block a user