MCPcopy Create free account
hub / github.com/catboost/catboost / CreateNehMessage

Method CreateNehMessage

library/cpp/par/par_network.cpp:300–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298 }
299
300 NNeh::TMessage CreateNehMessage(const TNetworkAddress& address, const TGUID& requestId, const TString& url, TVector<char>* data) {
301 CHROMIUM_TRACE_FUNCTION();
302
303 NNeh::TMessage msg;
304 msg.Addr = address.GetNehAddr();
305 TStringOutput messageStream(msg.Data);
306 messageStream << GetGuidAsString(requestId) << '\xff';
307 messageStream << url << '\xff';
308 if (data) {
309 const size_t origLen = data->size();
310 QuickLZCompress(data);
311 const size_t compressedLen = data->size();
312 auto val = Crc32c(data->data(), data->size());
313 messageStream << val << '\xff';
314 msg.Data.AppendNoAlias(data->data(), data->size());
315
316 TVector<char>().swap(*data);
317 PAR_DEBUG_LOG << "From " << GetHostAndPort() << " sending request " << GetGuidAsString(requestId) << " to " << address.GetNehAddr() << " service " << url << " data len: " << origLen << " (compressed: " << compressedLen << ")" << Endl;
318 } else {
319 PAR_DEBUG_LOG << "From " << GetHostAndPort() << " sending empty request " << GetGuidAsString(requestId) << " to " << address.GetNehAddr() << " service " << url << Endl;
320 }
321 return msg;
322 }
323 template <class TAddr = TSockAddrInetStream, class TSock = TInetStreamSocket>
324 static int GetFreeFamilyPort(const char* ip) {
325 TSock servSock;

Callers

nothing calls this directly

Calls 8

GetGuidAsStringFunction · 0.85
QuickLZCompressFunction · 0.85
Crc32cFunction · 0.85
GetHostAndPortFunction · 0.85
AppendNoAliasMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45
swapMethod · 0.45

Tested by

no test coverage detected