MCPcopy Create free account
hub / github.com/baldurk/renderdoc / TargetControlServerThread

Method TargetControlServerThread

renderdoc/core/target_control.cpp:433–559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

431}
432
433void RenderDoc::TargetControlServerThread(Network::Socket *sock)
434{
435 Threading::SetCurrentThreadName("TargetControlServerThread");
436
437 Threading::KeepModuleAlive();
438
439 RenderDoc::Inst().m_SingleClientName = "";
440
441 Threading::ThreadHandle clientThread = 0;
442
443 RenderDoc::Inst().m_ControlClientThreadShutdown = false;
444
445 while(!RenderDoc::Inst().m_TargetControlThreadShutdown)
446 {
447 Network::Socket *client = sock->AcceptClient(0);
448
449 if(client == NULL)
450 {
451 if(!sock->Connected())
452 {
453 RDCERR("Error in accept - shutting down server");
454
455 SAFE_DELETE(sock);
456 Threading::ReleaseModuleExitThread();
457 return;
458 }
459
460 Threading::Sleep(5);
461
462 continue;
463 }
464
465 rdcstr existingClient;
466 rdcstr newClient;
467 uint32_t version;
468 bool kick = false;
469
470 // receive handshake from client and get its name
471 {
472 ReadSerialiser ser(new StreamReader(client, Ownership::Nothing), Ownership::Stream);
473
474 ser.SetStreamingMode(true);
475
476 PacketType type = ser.ReadChunk<PacketType>();
477
478 if(type != ePacket_Handshake)
479 {
480 SAFE_DELETE(client);
481 continue;
482 }
483
484 SERIALISE_ELEMENT(version);
485 SERIALISE_ELEMENT(newClient);
486 SERIALISE_ELEMENT(kick);
487
488 ser.EndChunk();
489
490 strip_nonbasic(newClient);

Callers

nothing calls this directly

Calls 15

SetCurrentThreadNameFunction · 0.85
strip_nonbasicFunction · 0.85
SetStreamingModeMethod · 0.80
EndChunkMethod · 0.80
KeepModuleAliveFunction · 0.50
ReleaseModuleExitThreadFunction · 0.50
SleepFunction · 0.50
JoinThreadFunction · 0.50
CloseThreadFunction · 0.50
CreateThreadFunction · 0.50
AcceptClientMethod · 0.45

Tested by

no test coverage detected