scripted-diff: rename CSemaphoreGrant and CSemaphore for net
-BEGIN VERIFY SCRIPT- sed -i -e 's|CSemaphoreGrant|SemaphoreGrant|g' -e 's|CSemaphore|Semaphore|g' src/net.h src/net.cpp -END VERIFY SCRIPT-
This commit is contained in:
1 parent
d870bc9451
commit
6790ad27f1
2 files changed
+13
-13
No files matched your search
+8
-8
@@ -1893,7 +1893,7 @@ bool CConnman::AddConnection(const std::string& address, ConnectionType conn_typ
|
|||||||
if (max_connections != std::nullopt && existing_connections >= max_connections) return false;
|
if (max_connections != std::nullopt && existing_connections >= max_connections) return false;
|
||||||
|
|
||||||
// Max total outbound connections already exist
|
// Max total outbound connections already exist
|
||||||
CSemaphoreGrant grant(*semOutbound, true);
|
SemaphoreGrant grant(*semOutbound, true);
|
||||||
if (!grant) return false;
|
if (!grant) return false;
|
||||||
|
|
||||||
OpenNetworkConnection(CAddress(), false, std::move(grant), address.c_str(), conn_type, /*use_v2transport=*/use_v2transport);
|
OpenNetworkConnection(CAddress(), false, std::move(grant), address.c_str(), conn_type, /*use_v2transport=*/use_v2transport);
|
||||||
@@ -2409,7 +2409,7 @@ void CConnman::ProcessAddrFetch()
|
|||||||
// peer doesn't support it or immediately disconnects us for another reason.
|
// peer doesn't support it or immediately disconnects us for another reason.
|
||||||
const bool use_v2transport(GetLocalServices() & NODE_P2P_V2);
|
const bool use_v2transport(GetLocalServices() & NODE_P2P_V2);
|
||||||
CAddress addr;
|
CAddress addr;
|
||||||
CSemaphoreGrant grant(*semOutbound, /*fTry=*/true);
|
SemaphoreGrant grant(*semOutbound, /*fTry=*/true);
|
||||||
if (grant) {
|
if (grant) {
|
||||||
OpenNetworkConnection(addr, false, std::move(grant), strDest.c_str(), ConnectionType::ADDR_FETCH, use_v2transport);
|
OpenNetworkConnection(addr, false, std::move(grant), strDest.c_str(), ConnectionType::ADDR_FETCH, use_v2transport);
|
||||||
}
|
}
|
||||||
@@ -2583,7 +2583,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, std
|
|||||||
|
|
||||||
PerformReconnections();
|
PerformReconnections();
|
||||||
|
|
||||||
CSemaphoreGrant grant(*semOutbound);
|
SemaphoreGrant grant(*semOutbound);
|
||||||
if (interruptNet)
|
if (interruptNet)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -2961,7 +2961,7 @@ void CConnman::ThreadOpenAddedConnections()
|
|||||||
AssertLockNotHeld(m_reconnections_mutex);
|
AssertLockNotHeld(m_reconnections_mutex);
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
CSemaphoreGrant grant(*semAddnode);
|
SemaphoreGrant grant(*semAddnode);
|
||||||
std::vector<AddedNodeInfo> vInfo = GetAddedNodeInfo(/*include_connected=*/false);
|
std::vector<AddedNodeInfo> vInfo = GetAddedNodeInfo(/*include_connected=*/false);
|
||||||
bool tried = false;
|
bool tried = false;
|
||||||
for (const AddedNodeInfo& info : vInfo) {
|
for (const AddedNodeInfo& info : vInfo) {
|
||||||
@@ -2974,7 +2974,7 @@ void CConnman::ThreadOpenAddedConnections()
|
|||||||
CAddress addr(CService(), NODE_NONE);
|
CAddress addr(CService(), NODE_NONE);
|
||||||
OpenNetworkConnection(addr, false, std::move(grant), info.m_params.m_added_node.c_str(), ConnectionType::MANUAL, info.m_params.m_use_v2transport);
|
OpenNetworkConnection(addr, false, std::move(grant), info.m_params.m_added_node.c_str(), ConnectionType::MANUAL, info.m_params.m_use_v2transport);
|
||||||
if (!interruptNet.sleep_for(std::chrono::milliseconds(500))) return;
|
if (!interruptNet.sleep_for(std::chrono::milliseconds(500))) return;
|
||||||
grant = CSemaphoreGrant(*semAddnode, /*fTry=*/true);
|
grant = SemaphoreGrant(*semAddnode, /*fTry=*/true);
|
||||||
}
|
}
|
||||||
// See if any reconnections are desired.
|
// See if any reconnections are desired.
|
||||||
PerformReconnections();
|
PerformReconnections();
|
||||||
@@ -2985,7 +2985,7 @@ void CConnman::ThreadOpenAddedConnections()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if successful, this moves the passed grant to the constructed node
|
// if successful, this moves the passed grant to the constructed node
|
||||||
void CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, CSemaphoreGrant&& grant_outbound, const char *pszDest, ConnectionType conn_type, bool use_v2transport)
|
void CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, SemaphoreGrant&& grant_outbound, const char *pszDest, ConnectionType conn_type, bool use_v2transport)
|
||||||
{
|
{
|
||||||
AssertLockNotHeld(m_unused_i2p_sessions_mutex);
|
AssertLockNotHeld(m_unused_i2p_sessions_mutex);
|
||||||
assert(conn_type != ConnectionType::INBOUND);
|
assert(conn_type != ConnectionType::INBOUND);
|
||||||
@@ -3336,11 +3336,11 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
|
|||||||
|
|
||||||
if (semOutbound == nullptr) {
|
if (semOutbound == nullptr) {
|
||||||
// initialize semaphore
|
// initialize semaphore
|
||||||
semOutbound = std::make_unique<CSemaphore>(std::min(m_max_automatic_outbound, m_max_automatic_connections));
|
semOutbound = std::make_unique<Semaphore>(std::min(m_max_automatic_outbound, m_max_automatic_connections));
|
||||||
}
|
}
|
||||||
if (semAddnode == nullptr) {
|
if (semAddnode == nullptr) {
|
||||||
// initialize semaphore
|
// initialize semaphore
|
||||||
semAddnode = std::make_unique<CSemaphore>(m_max_addnode);
|
semAddnode = std::make_unique<Semaphore>(m_max_addnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -729,7 +729,7 @@ public:
|
|||||||
// Setting fDisconnect to true will cause the node to be disconnected the
|
// Setting fDisconnect to true will cause the node to be disconnected the
|
||||||
// next time DisconnectNodes() runs
|
// next time DisconnectNodes() runs
|
||||||
std::atomic_bool fDisconnect{false};
|
std::atomic_bool fDisconnect{false};
|
||||||
CSemaphoreGrant grantOutbound;
|
SemaphoreGrant grantOutbound;
|
||||||
std::atomic<int> nRefCount{0};
|
std::atomic<int> nRefCount{0};
|
||||||
|
|
||||||
const uint64_t nKeyedNetGroup;
|
const uint64_t nKeyedNetGroup;
|
||||||
@@ -1136,7 +1136,7 @@ public:
|
|||||||
bool GetNetworkActive() const { return fNetworkActive; };
|
bool GetNetworkActive() const { return fNetworkActive; };
|
||||||
bool GetUseAddrmanOutgoing() const { return m_use_addrman_outgoing; };
|
bool GetUseAddrmanOutgoing() const { return m_use_addrman_outgoing; };
|
||||||
void SetNetworkActive(bool active);
|
void SetNetworkActive(bool active);
|
||||||
void OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, CSemaphoreGrant&& grant_outbound, const char* strDest, ConnectionType conn_type, bool use_v2transport) EXCLUSIVE_LOCKS_REQUIRED(!m_unused_i2p_sessions_mutex);
|
void OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, SemaphoreGrant&& grant_outbound, const char* strDest, ConnectionType conn_type, bool use_v2transport) EXCLUSIVE_LOCKS_REQUIRED(!m_unused_i2p_sessions_mutex);
|
||||||
bool CheckIncomingNonce(uint64_t nonce);
|
bool CheckIncomingNonce(uint64_t nonce);
|
||||||
void ASMapHealthCheck();
|
void ASMapHealthCheck();
|
||||||
|
|
||||||
@@ -1491,8 +1491,8 @@ private:
|
|||||||
*/
|
*/
|
||||||
std::atomic<ServiceFlags> m_local_services;
|
std::atomic<ServiceFlags> m_local_services;
|
||||||
|
|
||||||
std::unique_ptr<CSemaphore> semOutbound;
|
std::unique_ptr<Semaphore> semOutbound;
|
||||||
std::unique_ptr<CSemaphore> semAddnode;
|
std::unique_ptr<Semaphore> semAddnode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum number of automatic connections permitted, excluding manual
|
* Maximum number of automatic connections permitted, excluding manual
|
||||||
@@ -1614,7 +1614,7 @@ private:
|
|||||||
struct ReconnectionInfo
|
struct ReconnectionInfo
|
||||||
{
|
{
|
||||||
CAddress addr_connect;
|
CAddress addr_connect;
|
||||||
CSemaphoreGrant grant;
|
SemaphoreGrant grant;
|
||||||
std::string destination;
|
std::string destination;
|
||||||
ConnectionType conn_type;
|
ConnectionType conn_type;
|
||||||
bool use_v2transport;
|
bool use_v2transport;
|
||||||
|
|||||||
Reference in new issue
Block a user