29 void send(std::unique_ptr<Tins::Packet> pkt) {
30 std::unique_lock<std::mutex> send_lock(send_mtx);
32 std::unique_lock<std::mutex> lock(mtx);
33 decrypted_packets.push(std::move(pkt));
43 std::optional<std::unique_ptr<Tins::Packet>>
receive() {
44 std::unique_lock<std::mutex> lock(mtx);
45 cv.wait(lock, [
this] {
return !decrypted_packets.empty() || closed; });
49 std::unique_ptr<Tins::Packet> value = std::move(decrypted_packets.front());
50 decrypted_packets.pop();
73 bool is_empty() {
return decrypted_packets.empty(); }
79 size_t len() {
return decrypted_packets.size(); }
87 return std::unique_lock(send_mtx);
97 std::queue<std::unique_ptr<Tins::Packet>> decrypted_packets;
100 std::condition_variable cv;
101 std::atomic<bool> closed;