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

Function get

plugins/multiplexer/fetcher.h:286–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284
285template <class T>
286bool
287get(const std::string &a, io::IO *const i, const int64_t l, const T &t, const int64_t ti = 0)
288{
289 using multiplexer_ns::dbg_ctl;
290 using Transaction = HttpTransaction<T>;
291 struct sockaddr_in socket;
292 socket.sin_family = AF_INET;
293 socket.sin_port = 80;
294 if (!inet_pton(AF_INET, a.c_str(), &socket.sin_addr)) {
295 Dbg(dbg_ctl, "ats::get Invalid address provided \"%s\".", a.c_str());
296 return false;
297 }
298 TSVConn vconn = TSHttpConnect(reinterpret_cast<sockaddr *>(&socket));
299 assert(vconn != nullptr);
300 TSCont contp = TSContCreate(Transaction::handle, TSMutexCreate());
301 assert(contp != nullptr);
302 Transaction *transaction = new Transaction(vconn, contp, i, l, t);
303 TSContDataSet(contp, transaction);
304 if (ti > 0) {
305 Dbg(dbg_ctl, "ats::get Setting active timeout to: %" PRId64, ti);
306 transaction->timeout(ti);
307 }
308 return true;
309}
310
311template <class T>
312bool

Callers 2

dispatchFunction · 0.70
TSRemapNewInstanceFunction · 0.50

Calls 6

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

Tested by

no test coverage detected