MCPcopy Create free account
hub / github.com/SFML/SFML / remove

Method remove

src/SFML/Network/SocketSelector.cpp:161–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159 }
160
161 bool remove(const Socket* socket)
162 {
163 const auto iter = std::find_if(sockets.begin(),
164 sockets.end(),
165 [&](const auto& entry) { return entry.socket == socket; });
166 if (iter != sockets.end())
167 {
168 // Only try to remove the handle from epoll if it is still valid i.e. the socket hasn't been closed yet
169 if (socket->getNativeHandle() != priv::SocketImpl::invalidSocket())
170 {
171 if (epoll_ctl(epollHandle, EPOLL_CTL_DEL, socket->getNativeHandle(), nullptr) < 0)
172 {
173 err() << "Failed to remove socket handle from epoll: " << errno << std::endl;
174 return false;
175 }
176 }
177 sockets.erase(iter);
178 return true;
179 }
180 return false;
181 }
182
183 void clear()
184 {

Callers

nothing calls this directly

Calls 6

epoll_ctlFunction · 0.85
eraseMethod · 0.80
getMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
getNativeHandleMethod · 0.45

Tested by

no test coverage detected