✋
This commit is contained in:
parent
775c8cf26f
commit
ea3d2ffc34
@ -52,7 +52,7 @@ void Connection::getPacks(SOCKET sock) {
|
|||||||
Input in;
|
Input in;
|
||||||
Sync sync;
|
Sync sync;
|
||||||
lsPck = recvPacksFrom(sock, &m_buf, m_addr);
|
lsPck = recvPacksFrom(sock, &m_buf, m_addr);
|
||||||
|
std::cout << "a";
|
||||||
for (auto& pck : lsPck) {
|
for (auto& pck : lsPck) {
|
||||||
uint32_t bsize = m_buf.len - (pck - m_buf.ptr);
|
uint32_t bsize = m_buf.len - (pck - m_buf.ptr);
|
||||||
switch (netprot::getType(pck, 1)) {
|
switch (netprot::getType(pck, 1)) {
|
||||||
@ -74,13 +74,15 @@ void Connection::getPacks(SOCKET sock) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Connection::sendPacks(SOCKET sock, std::unordered_map<uint64_t, Connection*> conns) {
|
void Connection::sendPacks(SOCKET sock, std::unordered_map<uint64_t, Connection*> conns) {
|
||||||
while (m_last_out < m_output_manifest.size()) {
|
while (!m_output_vector.empty()) {
|
||||||
Output out = m_output_vector.at(m_last_out++);
|
std::cout << "c";
|
||||||
|
Output out = m_output_vector.front();
|
||||||
for (auto& [key, conn] : conns) {
|
for (auto& [key, conn] : conns) {
|
||||||
if (m_playinfo.id == conn->GetHash(false))
|
if (m_playinfo.id == conn->GetHash(false))
|
||||||
continue;
|
continue;
|
||||||
sendPackTo<Output>(sock, &out, &m_bufout, conn->getAddr());
|
sendPackTo<Output>(sock, &out, &m_bufout, conn->getAddr());
|
||||||
}
|
}
|
||||||
|
m_output_vector.pop_front();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ private:
|
|||||||
std::unordered_map<Timestamp, Input> m_input_manifest;
|
std::unordered_map<Timestamp, Input> m_input_manifest;
|
||||||
std::vector<Input> m_input_vector;
|
std::vector<Input> m_input_vector;
|
||||||
std::unordered_map<Timestamp, Output> m_output_manifest;
|
std::unordered_map<Timestamp, Output> m_output_manifest;
|
||||||
std::vector<Output> m_output_vector;
|
std::deque<Output> m_output_vector;
|
||||||
std::unordered_map<Timestamp, Chat> m_chatlog;
|
std::unordered_map<Timestamp, Chat> m_chatlog;
|
||||||
|
|
||||||
SOCKET m_sock;
|
SOCKET m_sock;
|
||||||
|
@ -206,6 +206,7 @@ void Server::Run() {
|
|||||||
conn->getPacks(m_sock_udp);
|
conn->getPacks(m_sock_udp);
|
||||||
if (conn->m_nsync) {
|
if (conn->m_nsync) {
|
||||||
conn->Run(m_world);
|
conn->Run(m_world);
|
||||||
|
std::cout << "b";
|
||||||
conn->sendPacks(m_sock_udp, m_players);
|
conn->sendPacks(m_sock_udp, m_players);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user