| 1277 | } |
| 1278 | |
| 1279 | TString GetDebugInfo(const TUdpAddress& addr, double timeout) { |
| 1280 | NHPTimer::STime start; |
| 1281 | NHPTimer::GetTime(&start); |
| 1282 | TIntrusivePtr<IUdpHost> host = CreateUdpHost(0); |
| 1283 | { |
| 1284 | TAutoPtr<TRopeDataPacket> rq = new TRopeDataPacket; |
| 1285 | rq->Write((char)PKT_GETDEBUGINFO); |
| 1286 | ui32 crc32 = CalcChecksum(rq->GetChain()); |
| 1287 | host->Send(addr, rq.Release(), crc32, nullptr, PP_HIGH); |
| 1288 | } |
| 1289 | for (;;) { |
| 1290 | TAutoPtr<TRequest> ptr = host->GetRequest(); |
| 1291 | if (ptr.Get()) { |
| 1292 | TBlockChainIterator reqData(ptr->Data->GetChain()); |
| 1293 | int sz = reqData.GetSize(); |
| 1294 | TString res; |
| 1295 | res.resize(sz); |
| 1296 | reqData.Read(res.begin(), sz); |
| 1297 | return res; |
| 1298 | } |
| 1299 | host->Step(); |
| 1300 | host->Wait(0.1f); |
| 1301 | |
| 1302 | NHPTimer::STime now; |
| 1303 | NHPTimer::GetTime(&now); |
| 1304 | if (NHPTimer::GetSeconds(now - start) > timeout) { |
| 1305 | return TString(); |
| 1306 | } |
| 1307 | } |
| 1308 | } |
| 1309 | |
| 1310 | void Kill(const TUdpAddress& addr) { |
| 1311 | TIntrusivePtr<IUdpHost> host = CreateUdpHost(0); |
nothing calls this directly
no test coverage detected