mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 00:19:25 -05:00
merged upstream/master
This commit is contained in:
commit
9ce4b13e50
@ -739,7 +739,7 @@ bool ftTransferModule::locked_tickPeerTransfer(peerInfo &info)
|
||||
#endif
|
||||
/* update rate */
|
||||
|
||||
if(info.lastTransfers > 0 || ageReq > 2)
|
||||
if( (info.lastTransfers > 0 && ageReq > 0) || ageReq > 2)
|
||||
{
|
||||
info.actualRate = info.actualRate * 0.75 + 0.25 * info.lastTransfers / (float)ageReq;
|
||||
info.lastTransfers = 0;
|
||||
|
@ -279,12 +279,6 @@ int inet_aton(const char *name, struct in_addr *addr)
|
||||
#include <net/if.h>
|
||||
#endif // WINDOWS_SYS
|
||||
|
||||
void getLocalAddressesFailed()
|
||||
{
|
||||
std::cerr << "FATAL ERROR: getLocalAddresses failed!" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
bool getLocalAddresses(std::list<sockaddr_storage> & addrs)
|
||||
{
|
||||
addrs.clear();
|
||||
@ -304,7 +298,11 @@ bool getLocalAddresses(std::list<sockaddr_storage> & addrs)
|
||||
NULL,
|
||||
adapter_addresses,
|
||||
&bf_size);
|
||||
if (error != ERROR_SUCCESS) getLocalAddressesFailed();
|
||||
if (error != ERROR_SUCCESS)
|
||||
{
|
||||
std::cerr << "FATAL ERROR: getLocalAddresses failed!" << std::endl;
|
||||
return false ;
|
||||
}
|
||||
|
||||
IP_ADAPTER_ADDRESSES* adapter(NULL);
|
||||
for(adapter = adapter_addresses; NULL != adapter; adapter = adapter->Next)
|
||||
@ -321,7 +319,11 @@ bool getLocalAddresses(std::list<sockaddr_storage> & addrs)
|
||||
free(adapter_addresses);
|
||||
#else // WINDOWS_SYS
|
||||
struct ifaddrs *ifsaddrs, *ifa;
|
||||
if(getifaddrs(&ifsaddrs) != 0) getLocalAddressesFailed();
|
||||
if(getifaddrs(&ifsaddrs) != 0)
|
||||
{
|
||||
std::cerr << "FATAL ERROR: getLocalAddresses failed!" << std::endl;
|
||||
return false ;
|
||||
}
|
||||
for ( ifa = ifsaddrs; ifa; ifa = ifa->ifa_next )
|
||||
if ( ifa->ifa_addr && (ifa->ifa_flags & IFF_UP) )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user