From ea3d2ffc34301a276d201840a89723b717004d4a Mon Sep 17 00:00:00 2001 From: MarcEricMartel Date: Fri, 24 Nov 2023 15:56:58 -0500 Subject: [PATCH] :hand: --- SQCSim-srv/connection.cpp | 8 +++++--- SQCSim-srv/connection.h | 2 +- SQCSim-srv/server.cpp | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/SQCSim-srv/connection.cpp b/SQCSim-srv/connection.cpp index f7beced..d24e624 100644 --- a/SQCSim-srv/connection.cpp +++ b/SQCSim-srv/connection.cpp @@ -52,7 +52,7 @@ void Connection::getPacks(SOCKET sock) { Input in; Sync sync; lsPck = recvPacksFrom(sock, &m_buf, m_addr); - + std::cout << "a"; for (auto& pck : lsPck) { uint32_t bsize = m_buf.len - (pck - m_buf.ptr); switch (netprot::getType(pck, 1)) { @@ -74,13 +74,15 @@ void Connection::getPacks(SOCKET sock) { } void Connection::sendPacks(SOCKET sock, std::unordered_map conns) { - while (m_last_out < m_output_manifest.size()) { - Output out = m_output_vector.at(m_last_out++); + while (!m_output_vector.empty()) { + std::cout << "c"; + Output out = m_output_vector.front(); for (auto& [key, conn] : conns) { if (m_playinfo.id == conn->GetHash(false)) continue; sendPackTo(sock, &out, &m_bufout, conn->getAddr()); } + m_output_vector.pop_front(); } } diff --git a/SQCSim-srv/connection.h b/SQCSim-srv/connection.h index e8136bd..24530de 100644 --- a/SQCSim-srv/connection.h +++ b/SQCSim-srv/connection.h @@ -45,7 +45,7 @@ private: std::unordered_map m_input_manifest; std::vector m_input_vector; std::unordered_map m_output_manifest; - std::vector m_output_vector; + std::deque m_output_vector; std::unordered_map m_chatlog; SOCKET m_sock; diff --git a/SQCSim-srv/server.cpp b/SQCSim-srv/server.cpp index a5a354f..3a16cb7 100644 --- a/SQCSim-srv/server.cpp +++ b/SQCSim-srv/server.cpp @@ -206,6 +206,7 @@ void Server::Run() { conn->getPacks(m_sock_udp); if (conn->m_nsync) { conn->Run(m_world); + std::cout << "b"; conn->sendPacks(m_sock_udp, m_players); } }