25 Commits

Author SHA1 Message Date
Kawe Mazidjatari
656b0be3ec Improve threading (work in progress)
* Only run '_DownloadPlaylists_f()' in the main thread, schedule for next frame if we aren't in the main thread. (this should fix crash cases related to disconnecting from the game).

* Locked read/write to CBrowser members (thread for obtaining the server list is detached, but once the 'slow' post operation in this thread is complete, mutex lock is acquired (locking the render thread if the browser is active) to set the string members of CBrowser, this operation is very fast as we only set the string and the color after the http post operation (this never caused a crash, but the behavior without any lock mechanism is technically undefined regardless).

* Obtain the host name dynamically from the ConVar 'pylon_matchmaking_hostname' (atomic operation). Initial approach was deleting the whole master server pointer just to construct a new httpclient object..
2022-08-27 18:57:56 +02:00
Kawe Mazidjatari
619ac76452 Implement client rcon send log request
If 'cl_rcon_request_sendlogs' is set, the netconsole will request the server to send console logs to the rcon client after successful auth.
2022-08-17 11:50:40 +02:00
Kawe Mazidjatari
3c3da82154 Additional code improvements
* Removed some unused signatures.
* Named 2 CBaseFileSystem methods, and applied them to 'MOD_ProcessPakQueue()'.
* Renamed 'qword_1671061C8' to 'g_pMTVFTaskItem'.
* Renamed 'g_pMapVPKCache' to 'g_szMTVFItemName'.
* Only set first byte to 0 in 'g_szMTVFItemName' (actual size is 0x100, not 0x40).
2022-08-16 21:42:57 +02:00
Kawe Mazidjatari
88b3336758 Many small code improvements and optimizations
* Use c++ methods as much as possible.
* Use enum types for accessing NavMesh objects from array.
* Use size_t for for loops when testing against size types.
* Don't compute strlen twice of more on the same string.
* Don't use unnecessary c string casts if there is a method with a std::string overload.
* Don't create string objects from string pointers if we could use them directly.
* Don't initialize RCON password twice on each change, and don't set if the new password equals the old.
2022-08-11 11:07:45 +02:00
Kawe Mazidjatari
329621c6ad Move all public headers into root of 'public' 2022-08-09 17:18:07 +02:00
Kawe Mazidjatari
9ba5e63ada Add max size bounds for PayLoadLen when setting size of m_RecvBuffer
Should technically never fail, but in case it does it won't crash the application.
2022-08-03 18:41:25 +02:00
Kawe Mazidjatari
5bd6432862 Additional RCON system cleanup 2022-08-03 09:32:48 +02:00
Kawe Mazidjatari
9775fc4bba RCON system overhaul
* Implemented robust length-prefix framing logic for non-blocking sockets (previously used character sequences to determine length, but you cannot use character sequences on protocol buffers as its binary data. This logic should fix all problems regarding some commands not getting networked properly to the server and stuff not getting printed on the client).
* Increased buffer size to std::vector::max_size when netconsole is authenticated (MAX_NETCONSOLE_INPUT_LEN still remains enforced on accepted but not authenticated connections to prevent attackers from crashing the server).
* Process max 1024 bytes each recv buffer iteration.
* Additional optimizations and cleanup.
2022-08-02 23:58:43 +02:00
Kawe Mazidjatari
5795d15c83 Netconsole and ConVar improvements
Implemented StringSplit() (split string with a delimiter, and stop splitting after either the last delimiter has been reached, or nMax, so when nMax is 2, then 'SET mat_sky_color 255 255 0 255' gets split into: "SET" "mat_sky_color" "255 255 0 255").

Netconsole now sends ConVar's/ConCommands and values separately with use of StringSplit.

ConVar now uses internal ChangeStringValue (this runs the callback).
2022-07-31 17:07:35 +02:00
Amos
d909878624 Optimizations 2022-06-08 14:03:04 +02:00
Kawe Mazidjatari
326b751934 Light optimizations 2022-06-07 13:46:18 +02:00
Kawe Mazidjatari
61c7dbf5c1 Fix memory leaks 2022-05-28 23:05:10 +02:00
Kawe Mazidjatari
0549134133 Fix netconsole bug 2022-05-07 03:52:33 +02:00
Kawe Mazidjatari
57e6dc4280 Improve RCON system
* Buffers are now send properly from the game client and netconsole client (running scripts and executing command's/convar's now work properly).
* Removed 'PASS' string check on server and only rely on 'SERVERDATA_REQUEST_AUTH' enum for auth queries (should make heavy abuse even harder).
2022-05-07 03:06:19 +02:00
Amos
cf92d64a27 Use unicode character set instead of multi-byte 2022-03-04 16:06:36 +01:00
Amos
23f37bfa50 RCON QOL improvements 2022-02-24 16:44:33 +01:00
Amos
10174a6206 Initial game client RCON implementation 2022-02-14 23:16:24 +01:00
Amos
04be5e0e64 Use WSA error codes for startup/shutdown 2022-02-14 02:33:13 +01:00
Amos
a5b3b2dea4 Update comment blocks 2022-02-13 15:16:09 +01:00
Amos
9c8644e645 Implement stream serialization/deserialization in RCON server and client 2022-02-13 15:10:38 +01:00
Amos
ad65ff1f63 Small change 2022-02-09 21:29:34 +01:00
Amos
a5da2e81bf RCON improvements (see description)
** SERVER **
* Close redundant connections if max sockets have been reached.
* Ban if client keeps spamming without authing first (ignoring message).
* Check for whitelisted address before issuing bans (whitelisted address in ConVar 'sv_rcon_whitelist_address' will never get banned or get its connection terminated.
* Transmit SQVM and DevMsg logs over the wire to the net console.

** NETCON **
* IPv6 support.
* Close connection properly after FIN request.
* Prompt user to reconnect after connection has been terminated instead of closing the application.
* Add proper quit command.

** SDKLAUNCHER **
* Rename to 'launcher.exe' to describe its purpose better. Our logo gets printed nice and large on the console during startup.

** SDK **
* Cleanup.
2022-02-08 16:32:00 +01:00
Amos
7fff22ccec Slight cleanup 2022-02-06 17:27:47 +01:00
Amos
bba0120e88 Fix small bug in netconsole
Changed member params but forgot to change thread invocation params
2022-02-06 17:07:27 +01:00
Amos
c187bed4c5 RCON implementation (see description)
* Fully rewritten protocol agnostic CNetAdr class
* Fully rebuilded legacy CNetAdr class
* Fully rebuilded dual-stack CSocketCreator class
* New project "netconsole" added (lightweight netconsole for RCON)

RCON is still work in progress
2022-02-06 16:48:52 +01:00