mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-25 08:30:13 +00:00
fix: stabilize classic/turtle world session handling
Some checks failed
Build / Build (arm64) (push) Has been cancelled
Build / Build (x86-64) (push) Has been cancelled
Build / Build (macOS arm64) (push) Has been cancelled
Build / Build (windows-arm64) (push) Has been cancelled
Build / Build (windows-x86-64) (push) Has been cancelled
Security / CodeQL (C/C++) (push) Has been cancelled
Security / Semgrep (push) Has been cancelled
Security / Sanitizer Build (ASan/UBSan) (push) Has been cancelled
Some checks failed
Build / Build (arm64) (push) Has been cancelled
Build / Build (x86-64) (push) Has been cancelled
Build / Build (macOS arm64) (push) Has been cancelled
Build / Build (windows-arm64) (push) Has been cancelled
Build / Build (windows-x86-64) (push) Has been cancelled
Security / CodeQL (C/C++) (push) Has been cancelled
Security / Semgrep (push) Has been cancelled
Security / Sanitizer Build (ASan/UBSan) (push) Has been cancelled
This commit is contained in:
parent
43ebae217c
commit
f0a515ff9c
6 changed files with 522 additions and 179 deletions
|
|
@ -14,6 +14,7 @@
|
|||
#include <mutex>
|
||||
#include <atomic>
|
||||
#include <string>
|
||||
#include <array>
|
||||
|
||||
namespace wowee {
|
||||
namespace network {
|
||||
|
|
@ -90,6 +91,8 @@ private:
|
|||
void startAsyncPump();
|
||||
void stopAsyncPump();
|
||||
void closeSocketNoJoin();
|
||||
void recordRecentPacket(bool outbound, uint16_t opcode, uint16_t payloadLen);
|
||||
void dumpRecentPacketHistoryLocked(const char* reason, size_t bufferedBytes);
|
||||
|
||||
socket_t sockfd = INVALID_SOCK;
|
||||
bool connected = false;
|
||||
|
|
@ -131,6 +134,14 @@ private:
|
|||
std::chrono::steady_clock::time_point packetTraceUntil_{};
|
||||
std::string packetTraceReason_;
|
||||
|
||||
struct RecentPacketTrace {
|
||||
std::chrono::steady_clock::time_point when{};
|
||||
bool outbound = false;
|
||||
uint16_t opcode = 0;
|
||||
uint16_t payloadLen = 0;
|
||||
};
|
||||
std::deque<RecentPacketTrace> recentPacketHistory_;
|
||||
|
||||
// Packet callback
|
||||
std::function<void(const Packet&)> packetCallback;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue