| 55 | }; |
| 56 | |
| 57 | explicit TNehRequester( |
| 58 | int port, |
| 59 | TProcessQueryCancelCallback queryCancelCallback, |
| 60 | TProcessQueryCallback queryCallback, |
| 61 | TProcessReplyCallback replyCallback) |
| 62 | : QueryCancelCallback(std::move(queryCancelCallback)) |
| 63 | , QueryCallback(std::move(queryCallback)) |
| 64 | , ReplyCallback(std::move(replyCallback)) |
| 65 | { |
| 66 | NNeh::SetProtocolOption("tcp2/ServerOutputDeadline", "600s"); |
| 67 | MultiClient = NNeh::CreateMultiClient(); |
| 68 | MultiClientThread = SystemThreadFactory()->Run([this]() { |
| 69 | MultiClientThreadLoopFunction(); |
| 70 | }); |
| 71 | ReceiverServices = NNeh::CreateLoop(); |
| 72 | if (port == 0) { |
| 73 | ListenPort = GetFreeTcpPort(); |
| 74 | } else { |
| 75 | ListenPort = port; |
| 76 | } |
| 77 | TNetworkAddress serverAddr("*", ListenPort); |
| 78 | PAR_DEBUG_LOG << "Listening as " << serverAddr.GetNehAddr() << Endl; |
| 79 | ReceiverServices->Add(serverAddr.GetNehAddr(), [this](const NNeh::IRequestRef& req) { |
| 80 | NehServiceQueryCallback(req); |
| 81 | }); |
| 82 | ReceiverServices->ForkLoop(5); |
| 83 | PingerThread = SystemThreadFactory()->Run([this]() { |
| 84 | PingerThreadFunction(); |
| 85 | }); |
| 86 | } |
| 87 | |
| 88 | int GetListenPort() const override { |
| 89 | return ListenPort; |
nothing calls this directly
no test coverage detected