59 Commits

Author SHA1 Message Date
Dylan K. Taylor
17fee801e6 RCON: remove unnecessary function 2019-01-22 13:43:55 +00:00
Dylan K. Taylor
48a99937b9 more exception handling cleanup 2019-01-22 13:37:46 +00:00
Dylan K. Taylor
adc1069ed2 Merge branch '3.5' 2019-01-04 23:28:44 +00: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
7ee4fd55d3 Merge branch 'release/3.3' 2018-10-06 14:45:19 +01:00
Dylan K. Taylor
50b89c30f8 Merge branch 'release/3.2' into release/3.3 2018-10-06 14:45:12 +01:00
Dylan K. Taylor
adbd1c7bed RCON: remove redundant sleep
this dates back to the days where PM used to kill threads to stop them. Today we're more civilized and ask it to stop nicely, so this isn't necessary anymore.
2018-10-06 14:44:56 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
99fb267333 Merge branch 'release/3.3' 2018-09-04 15:58:24 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
4fb1f8dd76 Merge branch 'release/3.2' 2018-08-25 17:49:28 +01:00
Dylan K. Taylor
7dd53f2397 Replace unnecessary strlen > 0 calls with !== "" checks 2018-08-25 16:07:49 +01:00
Dylan K. Taylor
475ec413e5 Removed deprecated ServerCommandEvent and RemoteServerCommandEvent
if you get rekt by these changes... USE A RELEASE like we've been telling you for so long!
2018-08-19 14:23:41 +01:00
Dylan K. Taylor
2907de81ad Apply typehints to more general pocketmine\network namespace 2018-07-05 13:36:23 +01:00
Dylan K. Taylor
c43ce5c8fa RCONInstance: apply stfu operator 2018-06-29 12:16:17 +01:00
Dylan K. Taylor
6b2250cbce RCONInstance: terminate session on ECONNRESET errors 2018-06-24 17:32:51 +01:00
Dylan K. Taylor
30ad3a1705 RCONInstance: inherit runtime-defined INI entries 2018-06-18 10:32:17 +01:00
Dylan K. Taylor
05af87e1d4 Strip empty lines at the end of classes 2018-06-11 13:19:23 +01:00
Dylan K. Taylor
c4c6c58615 Added some missing typehints 2018-06-10 17:18:55 +01:00
Dylan K. Taylor
9c5f7128a4 RCON: lots of cleanup, now notification-based instead of poll-based
This now utilizes Snooze in order to have the server wake up to process RCON commands ondemand, similar to how the CommandReader thread operates. This is better for performance and response times.

This also makes a few other changes:
- RCON thread will now waste less CPU since it uses a blocking select() with timeout to read
- Following from that, IPC sockets are used to allow interrupting select() from the RCON thread.
- Multiple threads for RCON has been removed (this is entirely unnecessary, reading data from sockets is not CPU-intensive, and a single thread is easier to work with)
2018-05-10 12:33:05 +01:00
Dylan K. Taylor
e70af362d0 RCONInstance: fixup bad continues 2018-05-07 13:55:23 +01:00
Dylan K. Taylor
24aab8365e RCONInstance: remove redundant size ref param from readPacket() 2018-05-07 13:53:34 +01:00
Dylan K. Taylor
0e5504ed3f RCONInstance: add docs to fields, make 'stop' private 2018-05-07 13:52:33 +01:00
Dylan K. Taylor
83008440c0 RCONInstance: replace hardcoded status values with constants
I thought I'd seen the worst of PM, but I haven't.........
2018-05-07 13:44:59 +01:00
Dylan K. Taylor
b14dfa9f7e RCONInstance: Remove pointless code that makes pthreads segfault
pthreads doesn't play well with resources, and this code upsets it. Also, this code is utterly pointless.

The whole of RCON needs burning to the ground...
2018-05-07 10:05:05 +01:00
Dylan K. Taylor
ac5a91b67e Cleaned up bool comparison mess 2018-03-19 14:10:55 +00:00
Dylan K. Taylor
dcb53b1cbb RCON: Use PTHREADS_INHERIT_NONE - these threads don't need baggage from upstairs 2018-02-05 17:27:00 +00:00
Dylan K. Taylor
a52a2f6d26 RCON: register autoloader on RCON threads
fixes #1993
Interesting that this bug was never noticed before. Maybe because of the class getting loaded by PocketMine.php previously.
2018-02-04 22:24:19 +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
c4d8c28338 Some inspection fixes 2017-08-16 13:07:33 +01:00
Dylan K. Taylor
dbb92096e4 More typehints, documentation fixes and static analysis cleanup 2017-07-15 12:12:06 +01:00
Dylan K. Taylor
8cd31c2dc4 Fixed crashes starting RCON 2017-06-21 18:15:57 +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
9004417456 Fixed file headers (#255) 2017-01-13 16:57:05 +00:00
3DO2 - BlocksAndGold
383df298a6 fix crash at server stop when RCON is enable (#101) 2016-11-13 10:11:15 +00:00
SOFe
58ff381557 PhpStorm automated formatting (#11)
* PhpStorm reformatting

* Tuned PhpStorm reformatting

* Improved ItemIds and BlockIds formatting

* Tuned more PhpStorm reformatting

* Improved string concatenation
2016-10-03 19:05:48 +08:00
SOF3
6fc435da0e
Imports rearrangement 2016-10-03 00:43:46 +08:00
Shoghi Cervantes
3ffdb8e552 Removed @deprecated classes, methods and properties, added some type hints 2015-09-12 17:10:11 +02:00
Shoghi Cervantes
e137ac4c56 Base PHP7 work to make it "run" - READ NEXT LINES!
All plugins will need to bump the API if they want to use this.
NOTE THAT THIS IS NOT THE FINAL API 2.0.0 AND THAT THERE WILL BE MORE CHANGES.
To start updating, you might also want to read https://secure.php.net/manual/en/migration70.php and specifically https://secure.php.net/manual/en/migration70.incompatible.php

To compile PHP7 with some of the required dependencies, use https://gist.github.com/shoghicp/166ab26ce5cc7a390f45
ONLY LINUX IS TESTED, DO NOT ASK FOR OTHER PLATFORMS!

----- THIS VERSION IS NOT SUPPORTED -----

This version WILL crash randomly in unexpected places due to PHP7, pthreads, PocketMine or cosmic rays.

Handle with care, and store under direct sunlight for the best performance.
2015-09-10 21:29:29 +02:00
Shoghi Cervantes
7cf5df7e46 New console output formatting 2015-06-09 14:40:40 +02:00
Shoghi Cervantes
7ad98d4659 Deprecated CallbackTask, moved sleep checking to level 2015-04-25 17:28:30 +02:00
Shoghi Cervantes
b5b46bfd7e
Improved thread count 2015-03-17 00:47:43 +01:00
Shoghi Cervantes
747f7685e7 Fix formatting issues due to bad IDE settings 2014-12-07 16:30:04 +01:00
Shoghi Cervantes
8601405a88 Fixed CPU leak 2014-10-31 21:07:00 +01:00
Shoghi Cervantes
350cee3d41 Added Event allocation pool, updated SPL with Class::onClassLoaded() 2014-10-28 10:47:40 +01:00
Shoghi Cervantes
69492474e4 Improve #2238, do not crash when an invalid/corrupt RCON stop event happens 2014-10-28 02:09:36 +01:00
Shoghi Cervantes
9b85abd75e Micro-optimizations 2014-10-15 10:44:01 +02:00
Shoghi Cervantes
eab86f5f90 Replaced array() with [] 2014-08-28 17:04:22 +02:00
Shoghi Cervantes
db7222976e Code cleanup 2014-08-21 17:26:41 +02:00
Shoghi Cervantes
eee0eb5458 Added RemoteServerCommandEvent 2014-08-16 13:05:20 +02:00