mirror of
https://github.com/3proxy/3proxy.git
synced 2025-02-23 18:45:40 +08:00
Use WSAPoll on Windows (except lite version)
This commit is contained in:
parent
db485dd4c4
commit
a42bb38d76
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
BUILDDIR = ../bin/
|
BUILDDIR = ../bin/
|
||||||
CC = cl
|
CC = cl
|
||||||
CFLAGS = /nologo /MT /W3 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE)
|
CFLAGS = /nologo /MT /W3 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE)
|
||||||
COUT = /Fo
|
COUT = /Fo
|
||||||
LN = link
|
LN = link
|
||||||
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:I386
|
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:I386
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
BUILDDIR = ../bin64/
|
BUILDDIR = ../bin64/
|
||||||
CC = cl
|
CC = cl
|
||||||
CFLAGS = /nologo /MT /W3 /Ox /EHs- /GS /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE)
|
CFLAGS = /nologo /MT /W3 /Ox /EHs- /GS /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE)
|
||||||
COUT = /Fo
|
COUT = /Fo
|
||||||
LN = link
|
LN = link
|
||||||
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:x64
|
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:x64
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
BUILDDIR = ../bin64/
|
BUILDDIR = ../bin64/
|
||||||
CC = cl
|
CC = cl
|
||||||
CFLAGS = /nologo /MT /W3 /Ox /EHs- /GS /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE)
|
CFLAGS = /nologo /MT /W3 /Ox /EHs- /GS /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE)
|
||||||
COUT = /Fo
|
COUT = /Fo
|
||||||
LN = link
|
LN = link
|
||||||
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:arm64
|
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:arm64
|
||||||
|
12
src/common.c
12
src/common.c
@ -122,6 +122,7 @@ int myrand(void * entropy, int len){
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WITH_POLL
|
#ifndef WITH_POLL
|
||||||
|
#ifndef WITH_WSAPOLL
|
||||||
int
|
int
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
WINAPI
|
WINAPI
|
||||||
@ -157,6 +158,7 @@ int
|
|||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
struct sockfuncs so = {
|
struct sockfuncs so = {
|
||||||
socket,
|
socket,
|
||||||
@ -168,10 +170,14 @@ struct sockfuncs so = {
|
|||||||
getsockname,
|
getsockname,
|
||||||
getsockopt,
|
getsockopt,
|
||||||
setsockopt,
|
setsockopt,
|
||||||
#ifdef WITH_POLL
|
#ifndef WITH_POLL
|
||||||
poll,
|
#ifndef WITH_WSAPOLL
|
||||||
#else
|
|
||||||
mypoll,
|
mypoll,
|
||||||
|
#else
|
||||||
|
WSAPoll,
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
poll,
|
||||||
#endif
|
#endif
|
||||||
(void *)send,
|
(void *)send,
|
||||||
(void *)sendto,
|
(void *)sendto,
|
||||||
|
@ -116,12 +116,20 @@ int splicemap(struct clientparam * param, int timeo){
|
|||||||
if(res < 1){
|
if(res < 1){
|
||||||
RETURN(92);
|
RETURN(92);
|
||||||
}
|
}
|
||||||
if( (fds[0].revents & (POLLERR|POLLHUP|POLLNVAL)) && !(fds[0].revents & POLLIN)) {
|
if( (fds[0].revents & (POLLERR|POLLNVAL
|
||||||
|
#ifndef WITH_WSAPOLL
|
||||||
|
|POLLHUP
|
||||||
|
#endif
|
||||||
|
)) && !(fds[0].revents & POLLIN)) {
|
||||||
fds[0].revents = 0;
|
fds[0].revents = 0;
|
||||||
stop = 1;
|
stop = 1;
|
||||||
param->res = 90;
|
param->res = 90;
|
||||||
}
|
}
|
||||||
if( (fds[1].revents & (POLLERR|POLLHUP|POLLNVAL)) && !(fds[1].revents & POLLIN)){
|
if( (fds[1].revents & (POLLERR|POLLNVAL
|
||||||
|
#ifndef WITH_WSAPOLL
|
||||||
|
|POLLHUP
|
||||||
|
#endif
|
||||||
|
)) && !(fds[1].revents & POLLIN)){
|
||||||
fds[1].revents = 0;
|
fds[1].revents = 0;
|
||||||
stop = 1;
|
stop = 1;
|
||||||
param->res = 90;
|
param->res = 90;
|
||||||
@ -402,12 +410,20 @@ int sockmap(struct clientparam * param, int timeo){
|
|||||||
if(res < 1){
|
if(res < 1){
|
||||||
return 92;
|
return 92;
|
||||||
}
|
}
|
||||||
if( (fds[0].revents & (POLLERR|POLLHUP|POLLNVAL)) && !(fds[0].revents & POLLIN)) {
|
if( (fds[0].revents & (POLLERR|POLLNVAL
|
||||||
|
#ifndef WITH_WSAPOLL
|
||||||
|
|POLLHUP
|
||||||
|
#endif
|
||||||
|
)) && !(fds[0].revents & POLLIN)) {
|
||||||
fds[0].revents = 0;
|
fds[0].revents = 0;
|
||||||
stop = 1;
|
stop = 1;
|
||||||
retcode = 90;
|
retcode = 90;
|
||||||
}
|
}
|
||||||
if( (fds[1].revents & (POLLERR|POLLHUP|POLLNVAL)) && !(fds[1].revents & POLLIN)){
|
if( (fds[1].revents & (POLLERR|POLLNVAL
|
||||||
|
#ifndef WITH_WSAPOLL
|
||||||
|
|POLLHUP
|
||||||
|
#endif
|
||||||
|
)) && !(fds[1].revents & POLLIN)){
|
||||||
fds[1].revents = 0;
|
fds[1].revents = 0;
|
||||||
stop = 1;
|
stop = 1;
|
||||||
retcode = 90;
|
retcode = 90;
|
||||||
@ -460,7 +476,11 @@ int sockmap(struct clientparam * param, int timeo){
|
|||||||
return (99);
|
return (99);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((fds[0].revents & POLLIN)) {
|
if ((fds[0].revents & POLLIN)
|
||||||
|
#ifdef WITH_WSAPOLL
|
||||||
|
||(fds[0].revents & POLLHUP)
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
#if DEBUGLEVEL > 2
|
#if DEBUGLEVEL > 2
|
||||||
(*param->srv->logfunc)(param, "recv from client");
|
(*param->srv->logfunc)(param, "recv from client");
|
||||||
#endif
|
#endif
|
||||||
@ -488,7 +508,11 @@ int sockmap(struct clientparam * param, int timeo){
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!stop && (fds[1].revents & POLLIN)) {
|
if (!stop && ((fds[1].revents & POLLIN)
|
||||||
|
#ifdef WITH_WSAPOLL
|
||||||
|
||(fds[1].revents & POLLHUP)
|
||||||
|
#endif
|
||||||
|
)) {
|
||||||
#ifdef NOIPV6
|
#ifdef NOIPV6
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
#else
|
#else
|
||||||
|
@ -50,6 +50,11 @@ extern "C" {
|
|||||||
|
|
||||||
#ifdef WITH_POLL
|
#ifdef WITH_POLL
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
|
#else
|
||||||
|
#ifdef WITH_WSAPOLL
|
||||||
|
|
||||||
|
#define poll(A,B,C) WSAPoll(A,B,C)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
struct mypollfd {
|
struct mypollfd {
|
||||||
SOCKET fd; /* file descriptor */
|
SOCKET fd; /* file descriptor */
|
||||||
@ -80,7 +85,7 @@ int
|
|||||||
#ifndef POLLNVAL
|
#ifndef POLLNVAL
|
||||||
#define POLLNVAL 32
|
#define POLLNVAL 32
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user