30 Commits

Author SHA1 Message Date
Dylan K. Taylor
b42966f61b network: explicitly specify @return void 2020-01-18 19:35:01 +00:00
Dylan K. Taylor
db896b9faf ok i'm done
i am obviously not in any fit state to be doing this today...
2019-04-21 14:22:54 +01:00
Dylan K. Taylor
76c234e4e6 add some limits on batches 2019-04-21 14:16:38 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
0f941410f6 Use more appropriate exceptions in the protocol layer 2019-01-03 17:57:06 +00:00
Dylan K. Taylor
05af87e1d4 Strip empty lines at the end of classes 2018-06-11 13:19:23 +01:00
Dylan K. Taylor
732b931556 BatchPacket: use PacketPool::getPacket() instead of getPacketById()
this is what getPacket() is for.
2018-02-27 21:43:40 +00:00
Dylan K. Taylor
e6bd12dc2f Consolidated MCPE network binary handling methods into one class, remove protocol-specific methods from BinaryStream
Remove MCPE-network specific stuff from BinaryStream, added NetworkBinaryStream
This removes dependencies of BinaryStream on core code, while providing some consolidation of network handling code.
2018-01-11 12:28:56 +00:00
Dylan K. Taylor
4f8e4f0522
Add EOF newlines where missing (bulk) (#1836)
This should solve issues with people making GitHub PRs and having the web editor messing things up. GitHub Web Editor sucks :(
2017-12-20 11:56:36 +00:00
Dylan K. Taylor
74b074753f Bulk addition of constant visibilities
thanks PhpStorm inspections plugin for annoying the shit out of me until
I did this.
2017-11-21 14:44:10 +00:00
Dylan K. Taylor
7886918140 Cleaned up some bad code in DataPacket, added encode/decodeHeader and made encode/decodePayload protected 2017-08-06 17:21:51 +01:00
Dylan K. Taylor
77cd8e7799 More broken mess to spawn 1.2 2017-08-06 17:21:51 +01:00
Dylan K. Taylor
6341d3a0dc don't break the preprocessor 2017-07-13 12:09:03 +01:00
Dylan K. Taylor
72d1948f30 Improved batch handling 2017-07-13 12:04:47 +01:00
Dylan K. Taylor
30df0c2418 Refactor a bunch of network-related things for easier auto-generation of protocol stuff 2017-07-12 16:32:39 +01:00
Dylan K. Taylor
2726f2a011 Solved packet encode/decode boilerplate code issue
Something as simple as forgetting the reset() when encoding would cause lots of problems which could go unnoticed. This should be fully backwards-compatible but needs more tests.
2017-07-07 13:59:09 +01:00
Dylan K. Taylor
2024e9ecdf Fixed extremely stupid zero-length bug in BinaryStream
pls don't kill me 😢
2017-06-10 18:33:54 +01:00
Dylan K. Taylor
78c09267e5 Typehinted things in BinaryStream, sorted some methods and related bugfixes 2017-06-07 13:53:10 +01:00
Dylan K. Taylor
51b0673b4b Bite the bullet and enable strict types on everything 2017-06-07 12:53:16 +01:00
Dylan K. Taylor
fe8cb8cd86 Server->batchPackets() now only accepts DataPacket objects, fixed players receiving double PlayerListPackets with their own data 2017-05-17 17:15:42 +01:00
Dylan K. Taylor
11169b0777 add ifndef for BatchPacket 2017-05-13 14:57:48 +01:00
Dylan K. Taylor
50f7d04044 Import cleanup 2017-05-07 16:55:10 +01:00
Dylan K. Taylor
bf9b8722c9 Cleaned up batching checks 2017-04-26 22:02:45 +01:00
Dylan K. Taylor
6c5ca9b256 Protocol updates for 1.1.0.5 2017-04-20 13:54:55 +01:00
Dylan K. Taylor
c5eccc8e1c Minor improvements to Batch encoding 2017-04-15 19:40:06 +01:00
Dylan K. Taylor
e47c7ea55f A bunch of really dirty hacks to get 1.1.0.0 working
Mojang: once again, what the hell have you done.
2017-04-01 19:18:15 +01:00
Dylan K. Taylor
788bd6fc20 Fixed resource packs/login sequence fail, added basic safety restrictions for packet sending before clients are logged in
close #452
2017-03-26 14:42:23 +01:00
Dylan K. Taylor
6ba4a8fe5c Moved batch packet handling into BatchPacket->handle(), fixed data packet receive timings to include MCPE packet decode time 2017-03-20 10:26:53 +00:00
Dylan K. Taylor
ea0f291cb5 Added class method DataPacket->canBeBatched() 2017-03-08 20:28:40 +00:00
Dylan K. Taylor
56990eb28b MCPE protocol gets its own namespace 2017-03-08 20:28:39 +00:00