mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 16:39:29 -05:00
Protect p3BanList::isAddressAccepted with mutex
This method is called from other threads and apparently caused a sporadic crash caought on Android. See retroshare://forum?name=Got%20crash%20on%20Android%20with%20GDB%20backtrace&id=95de1451952d8c38cb1cdfdb85eed986&msgid=ac8c9d41f2cd0c9e8e290433c7f296fecb2d62b3
This commit is contained in:
parent
ac8043806b
commit
85ef0e0940
@ -306,18 +306,23 @@ bool p3BanList::acceptedBanRanges_locked(const BanListPeer& blp)
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
bool p3BanList::isAddressAccepted(
|
||||
const sockaddr_storage& dAddr, uint32_t checking_flags,
|
||||
uint32_t& check_result )
|
||||
{
|
||||
check_result = RSBANLIST_CHECK_RESULT_NOCHECK;
|
||||
if(!mIPFilteringEnabled) return true;
|
||||
|
||||
sockaddr_storage addr; sockaddr_storage_copy(dAddr, addr);
|
||||
|
||||
if(!sockaddr_storage_ipv6_to_ipv4(addr)) return true;
|
||||
if(sockaddr_storage_isLoopbackNet(addr)) return true;
|
||||
|
||||
|
||||
RS_STACK_MUTEX(mBanMtx);
|
||||
|
||||
if(!mIPFilteringEnabled) return true;
|
||||
|
||||
#ifdef DEBUG_BANLIST
|
||||
std::cerr << "isAddressAccepted(): tested addr=" << sockaddr_storage_iptostring(addr) << ", checking flags=" << checking_flags ;
|
||||
#endif
|
||||
@ -409,6 +414,7 @@ bool p3BanList::isAddressAccepted(
|
||||
check_result = RSBANLIST_CHECK_RESULT_ACCEPTED;
|
||||
return true ;
|
||||
}
|
||||
|
||||
void p3BanList::getWhiteListedIps(std::list<BanListPeer> &lst)
|
||||
{
|
||||
RS_STACK_MUTEX(mBanMtx) ;
|
||||
@ -582,11 +588,6 @@ int p3BanList::tick()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int p3BanList::status()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void p3BanList::getDhtInfo()
|
||||
{
|
||||
// Get the list of masquerading peers from the DHT. Add them as potential IPs to be banned.
|
||||
|
@ -105,7 +105,6 @@ public:
|
||||
|
||||
*/
|
||||
virtual int tick();
|
||||
virtual int status();
|
||||
|
||||
int sendPackets();
|
||||
bool processIncoming();
|
||||
|
Loading…
Reference in New Issue
Block a user