Skip to content
Repos

DevPlaceApp

C++ 557 B22 lines Opens in site

Directory Raw Download

#pragma once
// Private to net/. Spec: SPEC.md NFR-THR-01.
#include <atomic>
#include <thread>

#include "aiohttp/client/client_session.hpp"
#include "aiohttp/loop/event_loop.hpp"
#include "aiohttp/loop/task.hpp"
#include "net/NetworkService.hpp"

namespace dp {

struct NetworkService::Impl {
  std::thread thread;
  aiohttp::Loop* loop = nullptr;
  aiohttp::ClientSession* session = nullptr;
  std::atomic<std::size_t> inflight{0};

  aiohttp::Task<void> run(std::string base, HttpRequest req, CancelPtr cancel, HttpCallback done);
};

}  // namespace dp
26.7ms