Commit Graph

897 Commits

Author SHA1 Message Date
738e310798 Strip out RCON, closes #2686
Users should move to the new RconServer plugin instead.
2019-01-23 20:39:16 +00:00
d2284d5c47 Move Particle IDs to protocol namespace 2019-01-23 12:16:01 +00:00
2356991022 Merge branch '3.5' 2019-01-22 22:27:07 +00:00
45a4252c26 RCON: Explicitly specify connection backlog size, fixes #2685
I believe this is caused by a bug in the linux kernel, since it only impacts certain machines I tested (one, to be specific). Whatever the case, setting a max backlog size is prudent anyway, and fixes the problem.
2019-01-22 22:11:32 +00:00
feaaa925a7 Fixed a series of denial-of-service bugs in RCON
Packets with a too-short payload would either cause the RCON thread to hang until the client disconnected, or crash the RCON thread entirely.

commit 90bb1894d7f87645b806f5fc67d1b877bb963180
Author: Dylan K. Taylor <odigiman@gmail.com>
Date:   Tue Jan 22 18:15:46 2019 +0000

    fix some bugs in RCON
2019-01-22 22:05:15 +00:00
17fee801e6 RCON: remove unnecessary function 2019-01-22 13:43:55 +00:00
48a99937b9 more exception handling cleanup 2019-01-22 13:37:46 +00:00
ae7d6cc4a2 Merge branch '3.5' 2019-01-20 15:53:47 +00:00
47321114eb login: allow 60 seconds clock drift on login JWT
can everyone please just use NTP already?
2019-01-20 15:51:29 +00:00
467caf347d NetworkSession: Consistently don't use 0x prefix 2019-01-20 11:06:47 +00:00
5d8568b1a4 Add NetworkSession->getDisplayName(), clean up ip/port ad-hoc usages 2019-01-20 11:05:12 +00:00
6b7710e62b Introduce dedicated NBT data exceptions, fix up some corrupted chunk handling 2019-01-19 12:43:47 +00:00
2dee7e9e0f Properly handle Query packet errors 2019-01-17 22:22:53 +00:00
38cf8d157d Max players check now works properly
This now includes all connected sessions, whether they are considered online or not.
2019-01-17 21:40:10 +00:00
76f1ee1827 Add restrictions on packet send directions with interfaces
This prevents plugins sending wrong packets at the compiler level (or would, if we had a compiler). It's more robust than a getter for client/server and throwing an exception since a static analysis tool can detect faults created by sending wrong packets from the server. This is also used to deny service to dodgy clients which send wrong packets to the server to attack it.
2019-01-17 12:51:24 +00:00
b82e00ffdf Extract a Packet interface from DataPacket
this is in preparation for clientbound/serverbound packet separation. I did this already on another branch, but the changeset was dependent on a massive refactor to split apart packets and binarystream which i'm still not fully happy with.
2019-01-17 12:21:56 +00:00
2e7e56de1e Merge branch '3.5' 2019-01-16 21:52:03 +00:00
cb591a98f4 NetworkBinaryStream: Skip item NBT which is too large when encoded
Encoded tags larger than 32KB overflow the length field, so we can't send these over network. However, it's unreasonable to randomly throw this burden off onto users by crashing their servers, so the next best solution is to just not send the NBT. This is also not an ideal solution (books and the like with too-large tags won't work on the client side) but it's better than crashing the server or client due to a protocol bug. Mojang have confirmed this will be resolved by a future MCPE release, so we'll just work around this problem until then.
2019-01-16 21:50:43 +00:00
2656993223 AAAAAAAAAAAAAAAAAAAAAAAAAAAAA 2019-01-16 21:31:17 +00:00
fc98f4c42b Address more error cases, some minor cleanup 2019-01-16 21:30:31 +00:00
44ef9fc577 LoginPacket: account for some missed error cases 2019-01-16 21:00:28 +00:00
c9c6a5dc94 Fixed some doc comments 2019-01-16 20:48:26 +00:00
23269da1a6 Fixed the disaster of packet receive error handling 2019-01-16 19:53:48 +00:00
728bc95d73 NetworkSession: remove premature GC optimization
The only cyclic references here are both destroyed during normal collection directly (net interface removes from sessions array, player destroys its session reference), so there's no need to destroy them again here. This just causes a giant swathe of potential crashes for no real benefit.

close #2669
2019-01-16 16:50:16 +00:00
acdd0fec5f NetworkSession: player may be null 2019-01-16 16:19:39 +00:00
3e1aa3e2b4 Network: remove Server dependency 2019-01-13 20:41:17 +00:00
9c53b41851 Added PlayerInfo, Player is no longer accessible during PlayerPreLoginEvent 2019-01-13 19:32:30 +00:00
27761ac26e Fixed casing: Gamemode -> GameMode
it's two words, not one.
2019-01-12 16:19:31 +00:00
a756519e6b Move gamemode constants & functions to their own class
future enhancements:
- make gamemode an object containing information about abilities that players have in this gamemode (gamemodes are just predefined ability sets)
- get the magic numbers out of the API
2019-01-12 16:10:14 +00:00
49bdd92faa LoginPacket: Assert that extradata must exist 2019-01-11 17:56:18 +00:00
e9f023fe69 LoginPacket: fix corruption false-positives in offline mode 2019-01-11 17:55:58 +00:00
5d8fa2e126 Crash main server thread when RakLib dies
this way we get crashdumps and find out what's actually wrong with RakLib in the wild.
2019-01-09 19:04:12 +00:00
cc230034f9 Fixed TransactionData->actions default value, closes #2652 2019-01-09 14:15:06 +00:00
2924303169 Sync NBT dependency 2019-01-07 22:38:04 +00:00
9c16caf27b Fixed an edge-case in AvailableCommandsPacket decoding 2019-01-07 22:23:51 +00:00
4f50119b74 LoginPacket: Cater for more error cases
This now doesn't crash unexpectedly at the first sign of broken data.
2019-01-07 14:45:44 +00:00
adc1069ed2 Merge branch '3.5' 2019-01-04 23:28:44 +00:00
4b9a142a5d Import global functions and constants for enhanced performance
This is better for performance because these then don't need to be reevaluated every time they are called.

When encountering an unqualified function or constant reference, PHP will first try to locate a symbol in the current namespace by that name, and then fall back to the global namespace.
This short-circuits the check, which has substantial performance effects in some cases - in particular, ord(), chr() and strlen() show ~1500x faster calls when they are fully qualified.

However, this doesn't mean that PM is getting a massive amount faster. In real world terms, this translates to about 10-15% performance improvement.
But before anyone gets excited, you should know that the CodeOptimizer in the PreProcessor repo has been applying fully-qualified symbol optimizations to Jenkins builds for years, which is one of the reasons why Jenkins builds have better performance than home-built or source installations.
We're choosing to do this for the sake of future SafePHP integration and also to be able to get rid of the buggy CodeOptimizer, so that phar and source are more consistent.
2019-01-04 20:43:15 +00:00
febf1b1801 Merge branch '3.5' 2019-01-04 11:46:12 +00:00
11b59498d9 TakeItemEntityPacket: add missing decode, close #2633 2019-01-04 11:45:37 +00:00
8ef15d728a HandshakeSessionHandler: fix a doc comment bug
thank you PHPStan ❤️
2019-01-03 22:36:31 +00:00
c559dfccfe DataPacket: encode() and decode() are now final, encodePayload() and decodePayload() are now abstract 2019-01-03 21:14:54 +00:00
60687d8d6c Merge branch '3.5' 2019-01-03 18:02:33 +00:00
0f941410f6 Use more appropriate exceptions in the protocol layer 2019-01-03 17:57:06 +00:00
9840a3c980 Merge branch '3.5' 2019-01-03 17:29:53 +00:00
4d15eb3327 Cleaned up the InventoryTransactionPacket decoding clusterfuck
@shoghicp, y u do dis... I almost created a sub-packet architecture to deal with this shit :(

This mess really ought to be split into multiple packets. Perhaps the PacketPool can be extended to do that in the future.
2019-01-03 17:24:30 +00:00
504cc3bf8b AddEntityPacket: fix some bugs in legacy ID conversion handling 2019-01-03 17:00:16 +00:00
171be946c6 Network: burn some deprecated stuff 2019-01-01 20:53:33 +00:00
f81bbd60e8 Avoid use of internal fields in BinaryStream 2019-01-01 16:42:14 +00:00
4a629e1a26 DataPacket: remove dead function clean() 2019-01-01 15:43:05 +00:00