| 1427 | } |
| 1428 | |
| 1429 | TString GetDebugInfo(const TUdpAddress& addr, double timeout) { |
| 1430 | NHPTimer::STime start; |
| 1431 | NHPTimer::GetTime(&start); |
| 1432 | TIntrusivePtr<IUdpHost> host = CreateUdpHost(0); |
| 1433 | if (!host) { |
| 1434 | fprintf(stderr, "CreateUdpHost failed!\n"); |
| 1435 | return TString(); |
| 1436 | } |
| 1437 | |
| 1438 | TIntrusivePtr<IConnection> connection = host->Connect(addr, TConnectionSettings()); |
| 1439 | { |
| 1440 | TAutoPtr<TRopeDataPacket> rq = new TRopeDataPacket; |
| 1441 | rq->Write((char)PKT_GETDEBUGINFO); |
| 1442 | host->Send(connection, rq.Release(), PP_HIGH, TTos(), DEFAULT_NETLIBA_COLOR); |
| 1443 | } |
| 1444 | for (;;) { |
| 1445 | TAutoPtr<TUdpRequest> ptr = host->GetRequest(); |
| 1446 | if (ptr.Get()) { |
| 1447 | TBlockChainIterator reqData(ptr->Data->GetChain()); |
| 1448 | int sz = reqData.GetSize(); |
| 1449 | TString res; |
| 1450 | res.resize(sz); |
| 1451 | reqData.Read(res.begin(), sz); |
| 1452 | return res; |
| 1453 | } |
| 1454 | host->Step(); |
| 1455 | host->Wait(0.1f); |
| 1456 | |
| 1457 | NHPTimer::STime now; |
| 1458 | NHPTimer::GetTime(&now); |
| 1459 | if (NHPTimer::GetSeconds(now - start) > timeout) { |
| 1460 | return TString(); |
| 1461 | } |
| 1462 | } |
| 1463 | } |
| 1464 | |
| 1465 | void StopAllNetLibaThreads() { |
| 1466 | AtomicSwap(&PanicAttack, 1); // AAAA!!!! |
nothing calls this directly
no test coverage detected