diff options
author | George Hazan <george.hazan@gmail.com> | 2025-02-02 13:14:31 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2025-02-02 13:14:31 +0300 |
commit | 8b85a1d4242aadcdcb682a90059061cc72a868c0 (patch) | |
tree | c422b8def763555ec6c6b2c94afd4fed7a49e553 /protocols/Steam/src | |
parent | eff01c8846cc3323956ac140cbd140308e22d6f1 (diff) |
code simplification
Diffstat (limited to 'protocols/Steam/src')
-rw-r--r-- | protocols/Steam/src/steam_proto.h | 1 | ||||
-rw-r--r-- | protocols/Steam/src/steam_ws.cpp | 41 |
2 files changed, 15 insertions, 27 deletions
diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h index 70a00da312..67bd990529 100644 --- a/protocols/Steam/src/steam_proto.h +++ b/protocols/Steam/src/steam_proto.h @@ -164,7 +164,6 @@ class CSteamProto : public PROTO<CSteamProto> void* GetRequestInfo(uint64_t);
void __cdecl ServerThread(void *);
- bool ServerThreadStub(const char *szHost);
void ProcessMulti(const uint8_t *buf, size_t cbLen);
void ProcessMessage(const uint8_t *buf, size_t cbLen);
diff --git a/protocols/Steam/src/steam_ws.cpp b/protocols/Steam/src/steam_ws.cpp index 41acb5efbb..85c4ee5f33 100644 --- a/protocols/Steam/src/steam_ws.cpp +++ b/protocols/Steam/src/steam_ws.cpp @@ -34,43 +34,32 @@ void __cdecl CSteamProto::ServerThread(void *) m_ws = nullptr; CMStringA szHost; - do { - szHost.Format("Host%d", rand() % iHostCount); - szHost = db_get_sm(0, MODULENAME, szHost); - szHost.Insert(0, "wss://"); - szHost += "/cmsocket/"; - } - while (ServerThreadStub(szHost)); -} + szHost.Format("Host%d", rand() % iHostCount); + szHost = db_get_sm(0, MODULENAME, szHost); + szHost.Insert(0, "wss://"); + szHost += "/cmsocket/"; -bool CSteamProto::ServerThreadStub(const char *szHost) -{ WebSocket<CSteamProto> ws(this); NLHR_PTR pReply(ws.connect(m_hNetlibUser, szHost)); - if (pReply == nullptr) { - debugLogA("websocket connection failed"); - return false; - } + if (pReply) { + if (pReply->resultCode == 101) { + m_ws = &ws; - if (pReply->resultCode != 101) { - debugLogA("websocket connection failed: %d", pReply->resultCode); - return false; - } + debugLogA("Websocket connection succeeded"); - m_ws = &ws; + // Send init packets + Login(); - debugLogA("Websocket connection succeeded"); - - // Send init packets - Login(); - - ws.run(); + ws.run(); + } + else debugLogA("websocket connection failed: %d", pReply->resultCode); + } + else debugLogA("websocket connection failed"); Logout(); m_impl.m_heartBeat.Stop(); m_ws = nullptr; - return false; } ///////////////////////////////////////////////////////////////////////////////////////// |