mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Fixed upload speed problem of Windows systems.
Set TCP buffer size to 128 KB. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3782 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
ce75b486f4
commit
f769c66991
@ -622,6 +622,47 @@ int pqissl::Initiate_Connection()
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef WINDOWS_SYS
|
||||
/* Set TCP buffer size for Windows systems */
|
||||
|
||||
int sockbufsize = 0;
|
||||
int size = sizeof(int);
|
||||
|
||||
err = getsockopt(osock, SOL_SOCKET, SO_RCVBUF, (char *)&sockbufsize, &size);
|
||||
if (err == 0) {
|
||||
std::cerr << "pqissl::Initiate_Connection: Current TCP receive buffer size " << sockbufsize << std::endl;
|
||||
} else {
|
||||
std::cerr << "pqissl::Initiate_Connection: Error getting TCP receive buffer size. Error " << err << std::endl;
|
||||
}
|
||||
|
||||
sockbufsize = 0;
|
||||
|
||||
err = getsockopt(osock, SOL_SOCKET, SO_SNDBUF, (char *)&sockbufsize, &size);
|
||||
|
||||
if (err == 0) {
|
||||
std::cerr << "pqissl::Initiate_Connection: Current TCP send buffer size " << sockbufsize << std::endl;
|
||||
} else {
|
||||
std::cerr << "pqissl::Initiate_Connection: Error getting TCP send buffer size. Error " << err << std::endl;
|
||||
}
|
||||
|
||||
sockbufsize = WINDOWS_TCP_BUFFER_SIZE;
|
||||
|
||||
err = setsockopt(osock, SOL_SOCKET, SO_RCVBUF, (char *)&sockbufsize, sizeof(sockbufsize));
|
||||
|
||||
if (err == 0) {
|
||||
std::cerr << "pqissl::Initiate_Connection: TCP receive buffer size set to " << sockbufsize << std::endl;
|
||||
} else {
|
||||
std::cerr << "pqissl::Initiate_Connection: Error setting TCP receive buffer size. Error " << err << std::endl;
|
||||
}
|
||||
|
||||
err = setsockopt(osock, SOL_SOCKET, SO_SNDBUF, (char *)&sockbufsize, sizeof(sockbufsize));
|
||||
|
||||
if (err == 0) {
|
||||
std::cerr << "pqissl::Initiate_Connection: TCP send buffer size set to " << sockbufsize << std::endl;
|
||||
} else {
|
||||
std::cerr << "pqissl::Initiate_Connection: Error setting TCP send buffer size. Error " << err << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
mTimeoutTS = time(NULL) + mConnectTimeout;
|
||||
//std::cerr << "Setting Connect Timeout " << mConnectTimeout << " Seconds into Future " << std::endl;
|
||||
|
@ -59,6 +59,8 @@ const int PQISSL_DNS_FLAG = 0x04;
|
||||
/* not sure about the value? */
|
||||
const int PQISSL_UDP_FLAG = 0x02;
|
||||
|
||||
/* TCP buffer size for Windows systems */
|
||||
const int WINDOWS_TCP_BUFFER_SIZE = 128 * 1024; // 128 KB
|
||||
|
||||
/***************************** pqi Net SSL Interface *********************************
|
||||
* This provides the base SSL interface class,
|
||||
|
@ -223,6 +223,48 @@ int pqissllistenbase::setuplisten()
|
||||
"pqissllistenbase::setuplisten() Bound to Address.");
|
||||
}
|
||||
|
||||
#ifdef WINDOWS_SYS
|
||||
/* Set TCP buffer size for Windows systems */
|
||||
|
||||
int sockbufsize = 0;
|
||||
int size = sizeof(int);
|
||||
|
||||
err = getsockopt(lsock, SOL_SOCKET, SO_RCVBUF, (char *)&sockbufsize, &size);
|
||||
if (err == 0) {
|
||||
std::cerr << "pqissllistenbase::setuplisten: Current TCP receive buffer size " << sockbufsize << std::endl;
|
||||
} else {
|
||||
std::cerr << "pqissllistenbase::setuplisten: Error getting TCP receive buffer size. Error " << err << std::endl;
|
||||
}
|
||||
|
||||
sockbufsize = 0;
|
||||
|
||||
err = getsockopt(lsock, SOL_SOCKET, SO_SNDBUF, (char *)&sockbufsize, &size);
|
||||
|
||||
if (err == 0) {
|
||||
std::cerr << "pqissllistenbase::setuplisten: Current TCP send buffer size " << sockbufsize << std::endl;
|
||||
} else {
|
||||
std::cerr << "pqissllistenbase::setuplisten: Error getting TCP send buffer size. Error " << err << std::endl;
|
||||
}
|
||||
|
||||
sockbufsize = WINDOWS_TCP_BUFFER_SIZE;
|
||||
|
||||
err = setsockopt(lsock, SOL_SOCKET, SO_RCVBUF, (char *)&sockbufsize, sizeof(sockbufsize));
|
||||
|
||||
if (err == 0) {
|
||||
std::cerr << "pqissllistenbase::setuplisten: TCP receive buffer size set to " << sockbufsize << std::endl;
|
||||
} else {
|
||||
std::cerr << "pqissllistenbase::setuplisten: Error setting TCP receive buffer size. Error " << err << std::endl;
|
||||
}
|
||||
|
||||
err = setsockopt(lsock, SOL_SOCKET, SO_SNDBUF, (char *)&sockbufsize, sizeof(sockbufsize));
|
||||
|
||||
if (err == 0) {
|
||||
std::cerr << "pqissllistenbase::setuplisten: TCP send buffer size set to " << sockbufsize << std::endl;
|
||||
} else {
|
||||
std::cerr << "pqissllistenbase::setuplisten: Error setting TCP send buffer size. Error " << err << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (0 != (err = listen(lsock, 100)))
|
||||
{
|
||||
std::ostringstream out;
|
||||
|
Loading…
Reference in New Issue
Block a user