Skip to content

Commit 78c8f4f

Browse files
committed
refactor: Replace RecursiveMutex with Mutex in netbase.cpp
1 parent b1b1739 commit 78c8f4f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/netbase.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
#endif
2929

3030
// Settings
31-
static RecursiveMutex cs_proxyInfos;
32-
static proxyType proxyInfo[NET_MAX] GUARDED_BY(cs_proxyInfos);
33-
static proxyType nameProxy GUARDED_BY(cs_proxyInfos);
31+
static Mutex g_proxyinfo_mutex;
32+
static proxyType proxyInfo[NET_MAX] GUARDED_BY(g_proxyinfo_mutex);
33+
static proxyType nameProxy GUARDED_BY(g_proxyinfo_mutex);
3434
int nConnectTimeout = DEFAULT_CONNECT_TIMEOUT;
3535
bool fNameLookup = DEFAULT_NAME_LOOKUP;
3636

@@ -711,14 +711,14 @@ bool SetProxy(enum Network net, const proxyType &addrProxy) {
711711
assert(net >= 0 && net < NET_MAX);
712712
if (!addrProxy.IsValid())
713713
return false;
714-
LOCK(cs_proxyInfos);
714+
LOCK(g_proxyinfo_mutex);
715715
proxyInfo[net] = addrProxy;
716716
return true;
717717
}
718718

719719
bool GetProxy(enum Network net, proxyType &proxyInfoOut) {
720720
assert(net >= 0 && net < NET_MAX);
721-
LOCK(cs_proxyInfos);
721+
LOCK(g_proxyinfo_mutex);
722722
if (!proxyInfo[net].IsValid())
723723
return false;
724724
proxyInfoOut = proxyInfo[net];
@@ -744,26 +744,26 @@ bool GetProxy(enum Network net, proxyType &proxyInfoOut) {
744744
bool SetNameProxy(const proxyType &addrProxy) {
745745
if (!addrProxy.IsValid())
746746
return false;
747-
LOCK(cs_proxyInfos);
747+
LOCK(g_proxyinfo_mutex);
748748
nameProxy = addrProxy;
749749
return true;
750750
}
751751

752752
bool GetNameProxy(proxyType &nameProxyOut) {
753-
LOCK(cs_proxyInfos);
753+
LOCK(g_proxyinfo_mutex);
754754
if(!nameProxy.IsValid())
755755
return false;
756756
nameProxyOut = nameProxy;
757757
return true;
758758
}
759759

760760
bool HaveNameProxy() {
761-
LOCK(cs_proxyInfos);
761+
LOCK(g_proxyinfo_mutex);
762762
return nameProxy.IsValid();
763763
}
764764

765765
bool IsProxy(const CNetAddr &addr) {
766-
LOCK(cs_proxyInfos);
766+
LOCK(g_proxyinfo_mutex);
767767
for (int i = 0; i < NET_MAX; i++) {
768768
if (addr == static_cast<CNetAddr>(proxyInfo[i].proxy))
769769
return true;

0 commit comments

Comments
 (0)