MCPcopy Create free account
hub / github.com/apache/trafficserver / poll_on_socket

Function poll_on_socket

src/mgmt/rpc/server/IPCSocketServer.cc:56–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54// Check poll's return and validate against the passed function.
55template <typename Func>
56bool
57poll_on_socket(Func &&check_poll_return, std::chrono::milliseconds timeout, int fd)
58{
59 struct pollfd poll_fd;
60 poll_fd.fd = fd;
61 poll_fd.events = POLLIN; // when data is ready.
62 int poll_ret;
63 do {
64 poll_ret = poll(&poll_fd, 1, timeout.count());
65 } while (check_poll_return(poll_ret));
66
67 if (!(poll_fd.revents & POLLIN)) {
68 return false;
69 }
70 return true;
71}
72
73static bool
74has_peereid()

Callers 2

poll_for_new_clientMethod · 0.85
poll_for_dataMethod · 0.85

Calls 1

countMethod · 0.45

Tested by

no test coverage detected