mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +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());
|
connman->mapSendableNodes.erase(GetId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connman->m_edge_trig_events && !connman->m_edge_trig_events->UnregisterEvents(m_sock->Get())) {
|
if (connman->m_edge_trig_events) {
|
||||||
LogPrint(BCLog::NET, "EdgeTriggeredEvents::UnregisterEvents() failed\n");
|
connman->m_edge_trig_events->UnregisterEvents(m_sock->Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
LogPrint(BCLog::NET, "disconnecting peer=%d\n", id);
|
LogPrint(BCLog::NET, "disconnecting peer=%d\n", id);
|
||||||
@ -4310,10 +4310,10 @@ void CConnman::StopNodes()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Close listening sockets.
|
// Close listening sockets.
|
||||||
for (ListenSocket& hListenSocket : vhListenSocket) {
|
if (m_edge_trig_events) {
|
||||||
if (hListenSocket.sock) {
|
for (ListenSocket& hListenSocket : vhListenSocket) {
|
||||||
if (m_edge_trig_events && !m_edge_trig_events->RemoveSocket(hListenSocket.sock->Get())) {
|
if (hListenSocket.sock) {
|
||||||
LogPrintf("EdgeTriggeredEvents::RemoveSocket() failed\n");
|
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
|
* A manager for abstracting logic surrounding edge-triggered socket events
|
||||||
* modes like kqueue and epoll.
|
* 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
|
class EdgeTriggeredEvents
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Loading…
Reference in New Issue
Block a user