| 1081 | } |
| 1082 | } |
| 1083 | static void* ExecServerThread(void* param) { |
| 1084 | BindToSocket(0); |
| 1085 | SetHighestThreadPriority(); |
| 1086 | TUdpHttp* pThis = (TUdpHttp*)param; |
| 1087 | pThis->Host = CreateUdpHost(pThis->Socket); |
| 1088 | pThis->HasStarted.Signal(); |
| 1089 | if (!pThis->Host) { |
| 1090 | pThis->Socket.Drop(); |
| 1091 | return nullptr; |
| 1092 | } |
| 1093 | NHPTimer::GetTime(&pThis->PingsSendT); |
| 1094 | NHPTimer::GetTime(&pThis->ConnectionsCacheT); |
| 1095 | while (AtomicAdd(pThis->KeepRunning, 0) && !AtomicAdd(PanicAttack, 0)) { |
| 1096 | if (HeartbeatTimeout.load(std::memory_order_acquire) > 0) { |
| 1097 | NHPTimer::STime chk = LastHeartbeat.load(std::memory_order_acquire); |
| 1098 | double passed = NHPTimer::GetTimePassed(&chk); |
| 1099 | if (passed > HeartbeatTimeout.load(std::memory_order_acquire)) { |
| 1100 | StopAllNetLibaThreads(); |
| 1101 | fprintf(stderr, "%s\tTUdpHttp\tWaiting for %0.2f, time limit %0.2f, commit a suicide!11\n", Now().ToStringUpToSeconds().c_str(), passed, HeartbeatTimeout.load(std::memory_order_acquire)); |
| 1102 | fflush(stderr); |
| 1103 | #ifndef _win_ |
| 1104 | killpg(0, SIGKILL); |
| 1105 | #endif |
| 1106 | abort(); |
| 1107 | break; |
| 1108 | } |
| 1109 | } |
| 1110 | pThis->Step(); |
| 1111 | pThis->Wait(); |
| 1112 | } |
| 1113 | if (!AtomicAdd(pThis->AbortTransactions, 0) && !AtomicAdd(PanicAttack, 0)) |
| 1114 | pThis->FinishOutstandingTransactions(); |
| 1115 | pThis->Host = nullptr; |
| 1116 | return nullptr; |
| 1117 | } |
| 1118 | ~TUdpHttp() override { |
| 1119 | if (std::uncaught_exceptions()) { |
| 1120 | TUdpHttp::StopNoWait(); |
nothing calls this directly
no test coverage detected