mirror of
https://github.com/3proxy/3proxy.git
synced 2025-02-23 18:45:40 +08:00
FIX: tcppm may not work with parent proxy
This commit is contained in:
parent
d3395cf649
commit
28581b1738
@ -19,10 +19,9 @@ int clientnegotiate(struct chain * redir, struct clientparam * param, struct soc
|
|||||||
|
|
||||||
user = redir->extuser;
|
user = redir->extuser;
|
||||||
pass = redir->extpass;
|
pass = redir->extpass;
|
||||||
if (param->srvinbuf < 4096){
|
if (!param->srvbufsize){
|
||||||
if(param->srvbuf)myfree(param->srvbuf);
|
param->srvbufsize = SRVBUFSIZE;
|
||||||
param->srvbuf = myalloc(4096);
|
param->srvbuf = myalloc(param->srvbufsize);
|
||||||
param->srvbufsize = 4096;
|
|
||||||
}
|
}
|
||||||
buf = param->srvbuf;
|
buf = param->srvbuf;
|
||||||
username = buf + 2048;
|
username = buf + 2048;
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
#define UDPBUFSIZE 16384
|
#define UDPBUFSIZE 16384
|
||||||
#define TCPBUFSIZE 8192
|
#define TCPBUFSIZE 8192
|
||||||
|
#define SRVBUFSIZE (param->srv->bufsize?param->srv->bufsize:((param->service == S_UDPPM)?UDPBUFSIZE:TCPBUFSIZE))
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -7,9 +7,6 @@
|
|||||||
|
|
||||||
#include "proxy.h"
|
#include "proxy.h"
|
||||||
|
|
||||||
#define BUFSIZE (param->srv->bufsize?param->srv->bufsize:((param->service == S_UDPPM)?UDPBUFSIZE:TCPBUFSIZE))
|
|
||||||
|
|
||||||
|
|
||||||
int socksend(SOCKET sock, unsigned char * buf, int bufsize, int to){
|
int socksend(SOCKET sock, unsigned char * buf, int bufsize, int to){
|
||||||
int sent = 0;
|
int sent = 0;
|
||||||
int res;
|
int res;
|
||||||
@ -75,8 +72,8 @@ int sockgetcharcli(struct clientparam * param, int timeosec, int timeousec){
|
|||||||
int len;
|
int len;
|
||||||
|
|
||||||
if(!param->clibuf){
|
if(!param->clibuf){
|
||||||
if(!(param->clibuf = myalloc(BUFSIZE))) return 0;
|
if(!(param->clibuf = myalloc(SRVBUFSIZE))) return 0;
|
||||||
param->clibufsize = BUFSIZE;
|
param->clibufsize = SRVBUFSIZE;
|
||||||
param->clioffset = param->cliinbuf = 0;
|
param->clioffset = param->cliinbuf = 0;
|
||||||
}
|
}
|
||||||
if(param->cliinbuf && param->clioffset < param->cliinbuf){
|
if(param->cliinbuf && param->clioffset < param->cliinbuf){
|
||||||
@ -137,7 +134,7 @@ int sockgetcharsrv(struct clientparam * param, int timeosec, int timeousec){
|
|||||||
int bufsize;
|
int bufsize;
|
||||||
|
|
||||||
if(!param->srvbuf){
|
if(!param->srvbuf){
|
||||||
bufsize = BUFSIZE;
|
bufsize = SRVBUFSIZE;
|
||||||
if(param->ndatfilterssrv > 0 && bufsize < 32768) bufsize = 32768;
|
if(param->ndatfilterssrv > 0 && bufsize < 32768) bufsize = 32768;
|
||||||
if(!(param->srvbuf = myalloc(bufsize))) return 0;
|
if(!(param->srvbuf = myalloc(bufsize))) return 0;
|
||||||
param->srvbufsize = bufsize;
|
param->srvbufsize = bufsize;
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
|
|
||||||
#include "proxy.h"
|
#include "proxy.h"
|
||||||
|
|
||||||
#define BUFSIZE (param->srv->bufsize?param->srv->bufsize:((param->service == S_UDPPM)?UDPBUFSIZE:TCPBUFSIZE))
|
|
||||||
|
|
||||||
int sockmap(struct clientparam * param, int timeo){
|
int sockmap(struct clientparam * param, int timeo){
|
||||||
int res=0;
|
int res=0;
|
||||||
uint64_t sent=0, received=0;
|
uint64_t sent=0, received=0;
|
||||||
@ -21,13 +19,16 @@ int sockmap(struct clientparam * param, int timeo){
|
|||||||
FILTER_ACTION action;
|
FILTER_ACTION action;
|
||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
|
|
||||||
bufsize = BUFSIZE;
|
bufsize = SRVBUFSIZE;
|
||||||
|
|
||||||
minsize = (param->service == S_UDPPM || param->service == S_TCPPM)? bufsize - 1 : (bufsize>>2);
|
minsize = (param->service == S_UDPPM || param->service == S_TCPPM)? bufsize - 1 : (bufsize>>2);
|
||||||
|
|
||||||
fds[0].fd = param->clisock;
|
fds[0].fd = param->clisock;
|
||||||
fds[1].fd = param->remsock;
|
fds[1].fd = param->remsock;
|
||||||
|
|
||||||
|
|
||||||
|
if(param->cliinbuf == param->clioffset) param->cliinbuf = param->clioffset = 0;
|
||||||
|
if(param->srvinbuf == param->srvoffset) param->srvinbuf = param->srvoffset = 0;
|
||||||
#if DEBUGLEVEL > 2
|
#if DEBUGLEVEL > 2
|
||||||
(*param->srv->logfunc)(param, "Starting sockets mapping");
|
(*param->srv->logfunc)(param, "Starting sockets mapping");
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user