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

Method doStart

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

Source from the content-addressed store, hash-verified

100}
101
102void DebuggerService::doStart(int attemptNumber) {
103 if (_tcpServer != nullptr) {
104 return;
105 }
106
107 if (!_started) {
108 return;
109 }
110
111 _tcpServer = TCPServer::create(_debuggerPort, this);
112 auto result = _tcpServer->start();
113 if (result) {
114 VALDI_INFO(*_logger, "Started Valdi debugger service on {}", _debuggerPort);
115 } else {
116 [[maybe_unused]] auto attemptLogType = attemptNumber > 3 ? Valdi::LogTypeDebug : Valdi::LogTypeWarn;
117 VALDI_LOG(*_logger,
118 attemptLogType,
119 "Failed to start Valdi debugger service (attempt #{}): {}",
120 attemptNumber,
121 result.error());
122 _tcpServer = nullptr;
123
124 long retryDelay = attemptNumber < 5 ? attemptNumber : 5;
125 _dispatchQueue->asyncAfter([this, attemptNumber]() { this->doStart(attemptNumber + 1); },
126 std::chrono::seconds(retryDelay));
127 }
128}
129
130void DebuggerService::stop() {
131 _dispatchQueue->async([this]() {

Callers 1

startMethod · 0.95

Calls 4

startMethod · 0.65
errorMethod · 0.65
createFunction · 0.50
asyncAfterMethod · 0.45

Tested by

no test coverage detected