mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
style: remove unnecessary braces
They were needed to define the scope of `LOCK(cs_vNodes)` which was removed in the previous commit. Re-indent in a separate commit to ease review (use `--ignore-space-change`).
This commit is contained in:
56
src/net.cpp
56
src/net.cpp
@@ -1340,38 +1340,36 @@ bool CConnman::GenerateSelectSet(const std::vector<CNode*>& nodes,
|
|||||||
recv_set.insert(hListenSocket.socket);
|
recv_set.insert(hListenSocket.socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
for (CNode* pnode : nodes) {
|
||||||
for (CNode* pnode : nodes) {
|
// Implement the following logic:
|
||||||
// Implement the following logic:
|
// * If there is data to send, select() for sending data. As this only
|
||||||
// * If there is data to send, select() for sending data. As this only
|
// happens when optimistic write failed, we choose to first drain the
|
||||||
// happens when optimistic write failed, we choose to first drain the
|
// write buffer in this case before receiving more. This avoids
|
||||||
// write buffer in this case before receiving more. This avoids
|
// needlessly queueing received data, if the remote peer is not themselves
|
||||||
// needlessly queueing received data, if the remote peer is not themselves
|
// receiving data. This means properly utilizing TCP flow control signalling.
|
||||||
// receiving data. This means properly utilizing TCP flow control signalling.
|
// * Otherwise, if there is space left in the receive buffer, select() for
|
||||||
// * Otherwise, if there is space left in the receive buffer, select() for
|
// receiving data.
|
||||||
// receiving data.
|
// * Hand off all complete messages to the processor, to be handled without
|
||||||
// * Hand off all complete messages to the processor, to be handled without
|
// blocking here.
|
||||||
// blocking here.
|
|
||||||
|
|
||||||
bool select_recv = !pnode->fPauseRecv;
|
bool select_recv = !pnode->fPauseRecv;
|
||||||
bool select_send;
|
bool select_send;
|
||||||
{
|
{
|
||||||
LOCK(pnode->cs_vSend);
|
LOCK(pnode->cs_vSend);
|
||||||
select_send = !pnode->vSendMsg.empty();
|
select_send = !pnode->vSendMsg.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
LOCK(pnode->cs_hSocket);
|
LOCK(pnode->cs_hSocket);
|
||||||
if (pnode->hSocket == INVALID_SOCKET)
|
if (pnode->hSocket == INVALID_SOCKET)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
error_set.insert(pnode->hSocket);
|
error_set.insert(pnode->hSocket);
|
||||||
if (select_send) {
|
if (select_send) {
|
||||||
send_set.insert(pnode->hSocket);
|
send_set.insert(pnode->hSocket);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (select_recv) {
|
if (select_recv) {
|
||||||
recv_set.insert(pnode->hSocket);
|
recv_set.insert(pnode->hSocket);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user