From e6e95829bcc4446b882c3263d5769d39467721df Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 22 Sep 2016 13:44:53 +0200 Subject: [PATCH 1/2] fixed bug in estimation of next FT rate that caused downloads to stuck for a while --- libretroshare/src/ft/fttransfermodule.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libretroshare/src/ft/fttransfermodule.cc b/libretroshare/src/ft/fttransfermodule.cc index f5d5dfe84..7943a394b 100644 --- a/libretroshare/src/ft/fttransfermodule.cc +++ b/libretroshare/src/ft/fttransfermodule.cc @@ -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; From 7bddd4bcd49e9dfe606224e1a6cb7c106d723992 Mon Sep 17 00:00:00 2001 From: cyril soler Date: Fri, 23 Sep 2016 13:18:55 +0200 Subject: [PATCH 2/2] removed call to exit causing the software to stop when local network interfaces are not ready --- libretroshare/src/pqi/pqinetwork.cc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/libretroshare/src/pqi/pqinetwork.cc b/libretroshare/src/pqi/pqinetwork.cc index 4937aef64..db442f380 100644 --- a/libretroshare/src/pqi/pqinetwork.cc +++ b/libretroshare/src/pqi/pqinetwork.cc @@ -279,12 +279,6 @@ int inet_aton(const char *name, struct in_addr *addr) #include #endif // WINDOWS_SYS -void getLocalAddressesFailed() -{ - std::cerr << "FATAL ERROR: getLocalAddresses failed!" << std::endl; - exit(1); -} - bool getLocalAddresses(std::list & addrs) { addrs.clear(); @@ -304,7 +298,11 @@ bool getLocalAddresses(std::list & 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 & 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) ) {