mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-13 06:04:42 +02:00
scripted-diff: Rename Sock::{RECV,SEND,ERR}
The `ERR` macro is defined on illumos-based systems in the `regset.h`
header included by the Boost.Test framework, which causes a compilation
error.
-BEGIN VERIFY SCRIPT-
ren1() { sed -i "s/\<$1\>/$2/g" $( git grep -l "$1" ./src/util/sock.* ./src/httpserver.h ) ; }
ren1 RECV RecvEvent
ren1 SEND SendEvent
ren1 ERR ErrorEvent
ren2() { sed -i "s/\<$1\>/$2/g" $( git grep -l "$1" ./src/ ) ; }
ren2 Sock::RECV Sock::RecvEvent
ren2 Sock::SEND Sock::SendEvent
ren2 Sock::ERR Sock::ErrorEvent
-END VERIFY SCRIPT-
This commit is contained in:
@@ -168,10 +168,10 @@ bool Sock::WaitMany(std::chrono::milliseconds timeout, EventsPerSock& events_per
|
||||
pfds.emplace_back();
|
||||
auto& pfd = pfds.back();
|
||||
pfd.fd = sock->m_socket;
|
||||
if (events.requested & RECV) {
|
||||
if (events.requested & RecvEvent) {
|
||||
pfd.events |= POLLIN;
|
||||
}
|
||||
if (events.requested & SEND) {
|
||||
if (events.requested & SendEvent) {
|
||||
pfd.events |= POLLOUT;
|
||||
}
|
||||
}
|
||||
@@ -186,13 +186,13 @@ bool Sock::WaitMany(std::chrono::milliseconds timeout, EventsPerSock& events_per
|
||||
assert(sock->m_socket == static_cast<SOCKET>(pfds[i].fd));
|
||||
events.occurred = 0;
|
||||
if (pfds[i].revents & POLLIN) {
|
||||
events.occurred |= RECV;
|
||||
events.occurred |= RecvEvent;
|
||||
}
|
||||
if (pfds[i].revents & POLLOUT) {
|
||||
events.occurred |= SEND;
|
||||
events.occurred |= SendEvent;
|
||||
}
|
||||
if (pfds[i].revents & (POLLERR | POLLHUP)) {
|
||||
events.occurred |= ERR;
|
||||
events.occurred |= ErrorEvent;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
@@ -212,10 +212,10 @@ bool Sock::WaitMany(std::chrono::milliseconds timeout, EventsPerSock& events_per
|
||||
return false;
|
||||
}
|
||||
const auto& s = sock->m_socket;
|
||||
if (events.requested & RECV) {
|
||||
if (events.requested & RecvEvent) {
|
||||
FD_SET(s, &recv);
|
||||
}
|
||||
if (events.requested & SEND) {
|
||||
if (events.requested & SendEvent) {
|
||||
FD_SET(s, &send);
|
||||
}
|
||||
FD_SET(s, &err);
|
||||
@@ -232,13 +232,13 @@ bool Sock::WaitMany(std::chrono::milliseconds timeout, EventsPerSock& events_per
|
||||
const auto& s = sock->m_socket;
|
||||
events.occurred = 0;
|
||||
if (FD_ISSET(s, &recv)) {
|
||||
events.occurred |= RECV;
|
||||
events.occurred |= RecvEvent;
|
||||
}
|
||||
if (FD_ISSET(s, &send)) {
|
||||
events.occurred |= SEND;
|
||||
events.occurred |= SendEvent;
|
||||
}
|
||||
if (FD_ISSET(s, &err)) {
|
||||
events.occurred |= ERR;
|
||||
events.occurred |= ErrorEvent;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ void Sock::SendComplete(std::span<const unsigned char> data,
|
||||
// Wait for a short while (or the socket to become ready for sending) before retrying
|
||||
// if nothing was sent.
|
||||
const auto wait_time = std::min(deadline - now, std::chrono::milliseconds{MAX_WAIT_FOR_IO});
|
||||
(void)Wait(wait_time, SEND);
|
||||
(void)Wait(wait_time, SendEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,7 +373,7 @@ std::string Sock::RecvUntilTerminator(uint8_t terminator,
|
||||
|
||||
// Wait for a short while (or the socket to become ready for reading) before retrying.
|
||||
const auto wait_time = std::min(deadline - now, std::chrono::milliseconds{MAX_WAIT_FOR_IO});
|
||||
(void)Wait(wait_time, RECV);
|
||||
(void)Wait(wait_time, RecvEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user