12 spdlog::warn(
"Session is closed, cannot send packet");
15 spdlog::trace(
"Encrypting packet {}", packet_arg.packet_name());
16 const auto &packet =
static_cast<const Packet &
>(packet_arg);
18 packet.serialize_to_bytearray(buffer);
21 buffer = encryption_->encrypt(buffer);
24 buffer.insert(buffer.begin(), encryption_ ? std::byte{ 1 } : std::byte{ 0 });
26 spdlog::trace(
"Encrypted packet {}", packet_arg.packet_name());
29 if (packets_to_send_.push(value))
31 spdlog::trace(
"Pushing packet {}", packet_arg.packet_name());
35 std::this_thread::yield();
37 if (!alive_ || value !=
nullptr)