mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
refactor: re-order conditions over flags for m_edge_trig_events - follow-up for bitcoin#21563
This commit is contained in:
parent
6ed62b323c
commit
c52a582a3f
12
src/net.cpp
12
src/net.cpp
@ -663,8 +663,8 @@ void CNode::CloseSocketDisconnect(CConnman* connman)
|
||||
connman->mapSendableNodes.erase(GetId());
|
||||
}
|
||||
|
||||
if (connman->m_edge_trig_events && !connman->m_edge_trig_events->UnregisterEvents(m_sock->Get())) {
|
||||
LogPrint(BCLog::NET, "EdgeTriggeredEvents::UnregisterEvents() failed\n");
|
||||
if (connman->m_edge_trig_events) {
|
||||
connman->m_edge_trig_events->UnregisterEvents(m_sock->Get());
|
||||
}
|
||||
|
||||
LogPrint(BCLog::NET, "disconnecting peer=%d\n", id);
|
||||
@ -4310,10 +4310,10 @@ void CConnman::StopNodes()
|
||||
}
|
||||
|
||||
// Close listening sockets.
|
||||
for (ListenSocket& hListenSocket : vhListenSocket) {
|
||||
if (hListenSocket.sock) {
|
||||
if (m_edge_trig_events && !m_edge_trig_events->RemoveSocket(hListenSocket.sock->Get())) {
|
||||
LogPrintf("EdgeTriggeredEvents::RemoveSocket() failed\n");
|
||||
if (m_edge_trig_events) {
|
||||
for (ListenSocket& hListenSocket : vhListenSocket) {
|
||||
if (hListenSocket.sock) {
|
||||
m_edge_trig_events->RemoveSocket(hListenSocket.sock->Get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ enum class SocketEventsMode : int8_t;
|
||||
* A manager for abstracting logic surrounding edge-triggered socket events
|
||||
* modes like kqueue and epoll.
|
||||
*/
|
||||
// TODO: simplify this class to 2-3 flags; kick out everything else to Sock/~Sock and inherited classes
|
||||
class EdgeTriggeredEvents
|
||||
{
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user