MCPcopy Create free account
hub / github.com/Barracuda09/SATPI / initialize

Method initialize

src/socket/TcpSocket.cpp:55–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53// ============================================================================
54
55void TcpSocket::initialize(const std::string &ipAddr, int port, bool nonblock) {
56 for (std::size_t i = 0; i < _MAX_CLIENTS; ++i) {
57 _client[i].setProtocol(_protocolString);
58 }
59 if (initServerSocket(ipAddr, port, _MAX_CLIENTS, nonblock)) {
60 _pfd[0].fd = _server.getFD();
61 _pfd[0].events = POLLIN | POLLHUP | POLLRDNORM | POLLERR;
62 _pfd[0].revents = 0;
63
64 for (std::size_t i = 1; i < _MAX_POLL; ++i) {
65 _pfd[i].fd = -1;
66 _pfd[i].events = POLLIN | POLLHUP | POLLRDNORM | POLLERR;
67 _pfd[i].revents = 0;
68 }
69 }
70}
71
72int TcpSocket::poll(int timeout) {
73 if (::poll(_pfd, _MAX_POLL, timeout) > 0) {

Callers 1

StreamThreadBaseMethod · 0.45

Calls 2

setProtocolMethod · 0.80
getFDMethod · 0.80

Tested by

no test coverage detected