MCPcopy Create free account
hub / github.com/FastLED/FastLED / getOrCreateClientState

Method getOrCreateClientState

src/fl/net/http/stream_server.cpp.hpp:281–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279}
280
281HttpStreamServer::ClientState* HttpStreamServer::getOrCreateClientState(u32 clientId) {
282 // Check if state already exists
283 auto it = mClientStates.find(clientId);
284 if (it != mClientStates.end()) {
285 return &it->second;
286 }
287
288 // Create new state
289 mClientStates.insert(fl::make_pair(clientId, ClientState(clientId)));
290
291 // Find and return the newly created state
292 it = mClientStates.find(clientId);
293 if (it != mClientStates.end()) {
294 return &it->second;
295 }
296
297 return nullptr;
298}
299
300void HttpStreamServer::removeClientState(u32 clientId) {
301 auto it = mClientStates.find(clientId);

Callers

nothing calls this directly

Calls 5

make_pairFunction · 0.85
ClientStateClass · 0.85
findMethod · 0.45
endMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected