Commit Graph

85 Commits

Author SHA1 Message Date
7720a0534e Network: Each interface now keeps its own statistics
this allows more detailed analysis.
2019-04-18 19:57:40 +01:00
42a263a9df GameMode is now an enum 2019-03-31 16:19:36 +01:00
a9c76c2424 NetworkInterface: remove unused function 2019-03-26 15:09:43 +00:00
6990d6239e Network: Added RawPacketHandler interface, query handler is now a component 2019-03-24 18:02:19 +00:00
15c6554d8a Updated RakLib dependency 2019-03-23 12:52:50 +00:00
26a5d97499 Some cleanup to player net session handling for connect/disconnect 2019-03-14 14:32:43 +00:00
13b9fd7b66 RakLibInterface: Add error ID to make logs searchable when players report legitimate issues 2019-02-28 16:31:14 +00:00
01255c5368 Updated RakLib to get ITC efficiency enhancements 2019-02-15 12:29:16 +00:00
d378371cc8 Transition to spl_object_id() 2019-01-26 15:06:38 +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
23269da1a6 Fixed the disaster of packet receive error handling 2019-01-16 19:53:48 +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
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
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
171be946c6 Network: burn some deprecated stuff 2019-01-01 20:53:33 +00:00
c6a32ccf2a Merge branch 'release/3.5' 2019-01-01 14:08:20 +00:00
f7de6eb59f Network: Deprecate some garbage
Deprecations on a patch version breaks release protocol, but I don't care at this point. Nobody should have been using this shit anyway.
2018-12-31 22:52:39 +00:00
3ebd7e8ba6 Add network-wide API to filter raw packets by regex, stricter validation for Query 2018-12-28 16:30:52 +00:00
e13764832d Merge branch 'release/3.3' 2018-10-07 15:34:14 +01:00
0e508876d2 RakLibInterface: Disconnect players who trigger errors during handler
this is cleaner than leaving the player hanging for 5 seconds (which they'll often timeout from anyway). Banning the IP without kicking the player can often look like "lag" and end up getting brushed off as a performance issue.
2018-10-07 15:32:23 +01:00
495fdbd19f Move block and network namespaces away from PluginManager->callEvent()
the original step that wasn't supposed to cause conflicts, caused messy conflicts... so I might as well do this part too
2018-10-05 18:22:49 +01:00
dd2861dd1a Merge branch 'release/3.3' 2018-09-11 19:49:51 +01:00
519659fd2b Merge branch 'release/3.2' into release/3.3 2018-09-11 19:48:23 +01:00
6c70e84fa2 Merge branch 'release/3.1' into release/3.2 2018-09-11 19:47:46 +01:00
7d0e631a75 RakLibInterface: fixed processing hook being registered too early
this would cause bugs if the interface was not added directly to the network.
2018-09-11 19:47:26 +01:00
99fb267333 Merge branch 'release/3.3' 2018-09-04 15:58:24 +01:00
557fd34754 Make MainLogger independent of runtime-defined INI entries
Previously every thread using the logger had to inherit runtime-defined INI entries in order for the timezone to be set correctly. This removes that requirement.
2018-09-04 15:57:45 +01:00
f830eddd59 Merge branch 'mcpe-1.6' into mcpe-1.6-master 2018-08-21 17:55:48 +01:00
986077e03c Protocol changes for 1.6.0.1 2018-08-21 17:14:53 +01:00
5df601c817 Add @see docs so PhpStorm can see dynamic constructor usages
PhpStorm can't see constructor usages when the class name is dynamic. This causes maintenance problems because cross-referencing constructors called like this doesn't show up dynamic calls.
2018-08-19 16:00:15 +01:00
e43496e7e4 Network: clean up ticking handling, RakLib only processes on Snooze notification 2018-08-02 17:14:21 +01:00
85105ed066 Inseparable set of network changes - these all need each other to work
- Separated player handling and creation from network interfaces
- Rewire disconnects to make them not be recursive
- Batching now uses sessions instead of players
- Fixed DisconnectPacket getting sent to players who disconnect of their own accord
2018-07-21 20:03:05 +01:00
a86d3fe071 PlayerCreationEvent: Remove useless crap from constructor 2018-07-21 18:42:18 +01:00
b93318b2cf RakLibInterface: Use NetworkSession API for getting IP instead of Player
soon the network interfaces won't be dealing with Players at all.
2018-07-21 18:41:15 +01:00
ca1a0c8643 Move responsibility for ping handling to NetworkSession 2018-07-21 16:33:12 +01:00
3cd105ff33 Remove remnants of needACK functionality
this has been broken for a long time and hasn't been used for even longer.
2018-07-20 13:07:06 +01:00
bdd9a7eb52 Kill BatchPacket, clean up batching related things
DataPacketSendEvent and DataPacketReceiveEvent will no longer capture BatchPackets
In most places strings are now used instead of DataPackets, to remove limitations on what data can be sent to a network interface
Removed CraftingManager's cyclic dependency on Server

There is a lot more work to do aside from this, but this commit is intended to clean up what is necessary to fix the handling of BatchPacket.
2018-07-20 12:36:44 +01:00
4d1e2d1b3a Rename SourceInterface -> NetworkInterface
SourceInterface doesn't make sense really...
2018-07-18 11:03:21 +01:00
2907de81ad Apply typehints to more general pocketmine\network namespace 2018-07-05 13:36:23 +01:00
2e6afa54c2 [ci skip] typo 2018-06-12 21:20:00 +01:00
e36a6dc8cc Stop RakLib spamming the console when php.ini has a bad timezone 2018-06-12 21:18:33 +01:00
5e91c05424 Server::getIp() now returns 0.0.0.0 if the IP string is empty 2018-05-10 10:25:44 +01:00
68ef4b210d Allow RakLibServer to inherit constants (PATH const is needed for exception logging)
this is very annoying and needs a better fix.
2018-05-09 20:08:25 +01:00
72690ea7f5 RakLibInterface: start RakLibServer with PTHREADS_INHERIT_NONE
this is now OK since the logger colours will be initialized on the fly.
2018-05-09 20:00:09 +01:00
2a0a2134d1 Server: Implemented an signal/sleep interrupt mechanism for ticking (#2171)
This allows other threads to notify the main thread to wake it up while it's sleeping between ticks, allowing reduction of processing latency.

Currently only RakLib and the CommandReader threads utilize this, but it's planned to extend it to more things in the near future.

CommandReader is now event-driven instead of poll-based - the server will not poll the CommandReader thread for messages each tick anymore.

RakLib utilizes this mechanism to get packets processed without delays to lower latency.

This now adds an extra dependency - `pocketmine/snooze` library contains the meat of the code used for this. See the Snooze repository for details.
2018-05-09 14:18:13 +01:00
f497e43db3 SourceInterface: removed redundant return value from process() 2018-05-05 15:30:46 +01:00
ac5a91b67e Cleaned up bool comparison mess 2018-03-19 14:10:55 +00:00
d12b1d3e07 Updated RakLib dependency 2018-03-17 11:27:56 +00:00