| 284 | |
| 285 | template <class T> |
| 286 | bool |
| 287 | get(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 | |
| 311 | template <class T> |
| 312 | bool |
no test coverage detected