This commit is contained in:
MarcEricMartel
2023-11-24 13:42:53 -05:00
parent d7bd36d134
commit c1aa321f2b
2 changed files with 28 additions and 10 deletions

View File

@@ -52,14 +52,16 @@ void Connection::getPacks(SOCKET sock) {
Input in;
while (true) {
lsPck = recvPacksFrom(sock, &m_buf, m_addr);
for (auto& pck : lsPck) {
uint32_t bsize = m_buf.len - (pck - m_buf.ptr);
switch (netprot::getType(pck, 1)) {
using enum netprot::PACKET_TYPE;
case INPUT:
if (Deserialize(&in, pck, &bsize))
if (Deserialize(&in, pck, &bsize)) {
m_input_manifest[in.timestamp] = in;
if (in.keys.forward == true)
std::cout << "!!!!";
}
break;
default: break;
}
@@ -71,7 +73,7 @@ void Connection::getPacks(SOCKET sock) {
void Connection::sendPacks(SOCKET sock, std::unordered_map<uint64_t, Connection*> conns) {
while (m_last_out < m_output_manifest.size()) {
Output out = m_output_manifest.at(m_last_out++);
std::cout << "bip";
for (auto& [key, conn] : conns) {
if (m_playinfo.id == conn->GetHash(true))
continue;