1
0
mirror of https://github.com/danog/libtgvoip.git synced 2025-01-22 13:01:21 +01:00

Proxy fix

This commit is contained in:
Grishka 2017-07-04 03:04:59 +03:00
parent 1be4d016a4
commit 445433f4f0
2 changed files with 6 additions and 2 deletions

View File

@ -479,6 +479,7 @@ void NetworkSocketSOCKS5Proxy::Close(){
void NetworkSocketSOCKS5Proxy::Connect(NetworkAddress *address, uint16_t port){
if(!failed){
tcp->SetTimeouts(1, 2);
unsigned char buf[1024];
BufferOutputStream out(buf, sizeof(buf));
out.WriteByte(5); // VER
@ -521,6 +522,7 @@ void NetworkSocketSOCKS5Proxy::Connect(NetworkAddress *address, uint16_t port){
connectedAddress=v4 ? (NetworkAddress*)new IPv4Address(*v4) : (NetworkAddress*)new IPv6Address(*v6);
connectedPort=port;
LOGV("socks5: connect succeeded");
tcp->SetTimeouts(5, 60);
}
}
@ -530,6 +532,7 @@ NetworkSocket *NetworkSocketSOCKS5Proxy::GetWrapped(){
void NetworkSocketSOCKS5Proxy::InitConnection(){
unsigned char buf[1024];
tcp->SetTimeouts(1, 2);
BufferOutputStream p(buf, sizeof(buf));
p.WriteByte(5); // VER
if(!username.empty()){
@ -589,6 +592,7 @@ void NetworkSocketSOCKS5Proxy::InitConnection(){
failed=true;
return;
}
tcp->SetTimeouts(5, 60);
}
bool NetworkSocketSOCKS5Proxy::IsFailed(){

View File

@ -1774,9 +1774,9 @@ void VoIPController::SendPacket(unsigned char *data, size_t len, Endpoint* ep){
return;
}
s=proxy;
}else if(proxyProtocol==PROXY_HTTP){
}/*else if(proxyProtocol==PROXY_HTTP){
s=NetworkSocket::Create(PROTO_TCP);
}else{
}*/else{
LOGE("Unsupported proxy protocol %d", proxyProtocol);
SetState(STATE_FAILED);
return;