MCPcopy Create free account
hub / github.com/apache/trafficserver / get

Function get

plugins/experimental/inliner/fetcher.h:304–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302
303template <class T>
304bool
305get(const std::string &a, std::unique_ptr<io::IO> i, const int64_t l, const T &t, const int64_t ti = 0)
306{
307 using Transaction = HttpTransaction<T>;
308 struct sockaddr_in socket;
309 socket.sin_family = AF_INET;
310 socket.sin_port = 80;
311 if (!inet_pton(AF_INET, a.c_str(), &socket.sin_addr)) {
312 Dbg(dbg_ctl, "ats::get Invalid address provided \"%s\".", a.c_str());
313 return false;
314 }
315 TSVConn vconn = TSHttpConnect(reinterpret_cast<sockaddr *>(&socket));
316 assert(vconn != nullptr);
317 TSCont contp = TSContCreate(Transaction::handle, nullptr);
318 assert(contp != nullptr);
319 Transaction *transaction = new Transaction(vconn, contp, std::move(i), l, t);
320 TSContDataSet(contp, transaction);
321 if (ti > 0) {
322 Dbg(dbg_ctl, "ats::get Setting active timeout to: %" PRId64, ti);
323 transaction->timeout(ti);
324 }
325 return true;
326}
327
328template <class T>
329bool

Callers 1

missMethod · 0.70

Calls 5

TSHttpConnectFunction · 0.85
TSContCreateFunction · 0.85
TSContDataSetFunction · 0.85
c_strMethod · 0.45
timeoutMethod · 0.45

Tested by

no test coverage detected