| 714 | } |
| 715 | |
| 716 | static void* ExecServerThread(void* param) { |
| 717 | TUdpHttp* pThis = (TUdpHttp*)param; |
| 718 | if (pThis->GetPhysicalCpu() >= 0) { |
| 719 | BindToSocket(pThis->GetPhysicalCpu()); |
| 720 | } |
| 721 | SetHighestThreadPriority(); |
| 722 | |
| 723 | TIntrusivePtr<NNetlibaSocket::ISocket> socket = NNetlibaSocket::CreateSocket(); |
| 724 | socket->Open(pThis->Port_); |
| 725 | if (socket->IsValid()) { |
| 726 | pThis->Port_ = socket->GetPort(); |
| 727 | pThis->Host_ = CreateUdpHost(socket); |
| 728 | } else { |
| 729 | pThis->Host_ = nullptr; |
| 730 | } |
| 731 | |
| 732 | pThis->HasStarted_.Signal(); |
| 733 | if (!pThis->Host_) |
| 734 | return nullptr; |
| 735 | |
| 736 | NHPTimer::GetTime(&pThis->PingsSendT_); |
| 737 | while (AtomicGet(pThis->KeepRunning_) && !PanicAttack) { |
| 738 | if (HeartbeatTimeout.load(std::memory_order_acquire) > 0) { |
| 739 | NHPTimer::STime chk = LastHeartbeat.load(std::memory_order_acquire); |
| 740 | if (NHPTimer::GetTimePassed(&chk) > HeartbeatTimeout.load(std::memory_order_acquire)) { |
| 741 | StopAllNetLibaThreads(); |
| 742 | #ifndef _win_ |
| 743 | killpg(0, SIGKILL); |
| 744 | #endif |
| 745 | abort(); |
| 746 | break; |
| 747 | } |
| 748 | } |
| 749 | pThis->Step(); |
| 750 | pThis->Wait(); |
| 751 | } |
| 752 | if (!pThis->AbortTransactions_ && !PanicAttack) { |
| 753 | pThis->FinishOutstandingTransactions(); |
| 754 | } |
| 755 | pThis->Host_ = nullptr; |
| 756 | return nullptr; |
| 757 | } |
| 758 | |
| 759 | int GetPhysicalCpu() const noexcept { |
| 760 | return PhysicalCpu_; |
nothing calls this directly
no test coverage detected