MCPcopy Create free account
hub / github.com/Snapchat/Valdi / addDaemonClient

Method addDaemonClient

valdi/src/valdi/runtime/Debugger/DebuggerService.cpp:259–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

257 int senderClientId,
258 const BytesView& payload) {
259 std::lock_guard<Mutex> lock(_mutex);
260 for (const auto& it : _listeners) {
261 auto listener = it.lock();
262 if (listener != nullptr) {
263 listener->daemonClientDidReceiveClientPayload(strongRef(daemonClient), senderClientId, payload);
264 }
265 }
266}
267
268Ref<DaemonClient> DebuggerService::addDaemonClient(const Ref<ITCPConnection>& tcpClient) {
269 if (_runtimeMessageHandler != nullptr) {
270 _runtimeMessageHandler->onDebugMessage(LogTypeInfo, "Connected to Valdi Hot Reloader!");
271 }
272
273 std::lock_guard<Mutex> guard(_mutex);
274
275 auto daemonClient = Valdi::makeShared<DaemonClient>(this, ++_connectionIdSequence, _logger);
276 tcpClient->setDataListener(Valdi::makeShared<DaemonClientTCPListener>(daemonClient));
277 daemonClient->setDataSender(Valdi::makeShared<DaemonClientTCPDataSender>(tcpClient));
278 _clients.emplace_back(daemonClient);
279
280 for (const auto& it : _listeners) {
281 auto listener = it.lock();
282 if (listener != nullptr) {

Callers

nothing calls this directly

Calls 6

setDataSenderMethod · 0.80
toSharedMethod · 0.80
onDebugMessageMethod · 0.45
setDataListenerMethod · 0.45
lockMethod · 0.45
daemonClientConnectedMethod · 0.45

Tested by

no test coverage detected