| 256 | } |
| 257 | |
| 258 | void |
| 259 | dispatch(Requests &r, const int t) |
| 260 | { |
| 261 | Requests::iterator iterator = r.begin(); |
| 262 | const Requests::iterator end = r.end(); |
| 263 | for (; iterator != end; ++iterator) { |
| 264 | assert(iterator->io.get() != nullptr); |
| 265 | if (dbg_ctl.on()) { |
| 266 | Dbg(dbg_ctl, "Dispatching %i bytes to \"%s\"", iterator->length, iterator->host.c_str()); |
| 267 | std::string b; |
| 268 | read(iterator->io->reader, b); |
| 269 | assert(b.size() == static_cast<uint64_t>(iterator->length)); |
| 270 | Dbg(dbg_ctl, "%s", b.c_str()); |
| 271 | } |
| 272 | // forwarding iterator->io pointer ownership |
| 273 | ats::get(iterator->io.release(), iterator->length, Handler(iterator->host), t); |
| 274 | } |
| 275 | } |