MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / Wait

Method Wait

src/util/sock.cpp:141–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141bool Sock::Wait(std::chrono::milliseconds timeout, Event requested, Event* occurred) const
142{
143 // We need a `shared_ptr` holding `this` for `WaitMany()`, but don't want
144 // `this` to be destroyed when the `shared_ptr` goes out of scope at the
145 // end of this function.
146 // Create it with an aliasing shared_ptr that points to `this` without
147 // owning it.
148 std::shared_ptr<const Sock> shared{std::shared_ptr<const Sock>{}, this};
149
150 EventsPerSock events_per_sock{std::make_pair(shared, Events{requested})};
151
152 if (!WaitMany(timeout, events_per_sock)) {
153 return false;
154 }
155
156 if (occurred != nullptr) {
157 *occurred = events_per_sock.begin()->second.occurred;
158 }
159
160 return true;
161}
162
163bool Sock::WaitMany(std::chrono::milliseconds timeout, EventsPerSock& events_per_sock) const
164{

Callers 7

AcceptMethod · 0.45
WaitForDataMethod · 0.45
SendRequestMethod · 0.45
RecvMethod · 0.45
InterruptibleRecvFunction · 0.45
ConnectToSocketFunction · 0.45
PCPSendRecvFunction · 0.45

Calls 1

beginMethod · 0.45

Tested by

no test coverage detected