PocketMine-MP 5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
pocketmine\console\ConsoleReaderChildProcessDaemon Class Reference
+ Collaboration diagram for pocketmine\console\ConsoleReaderChildProcessDaemon:

Public Member Functions

 __construct (\Logger $logger)
 
 quit ()
 
 readLine ()
 

Public Attributes

const TOKEN_DELIMITER = ":"
 
const TOKEN_HASH_ALGO = "xxh3"
 

Detailed Description

This pile of shit exists because PHP on Windows is broken, and can't handle stream_select() on stdin or pipes properly - stdin native triggers stream_select() when a key is pressed, causing it to get stuck in fgets() waiting for a line that might never come (and Windows doesn't support character-based reading either), and pipes just constantly trigger stream_select() instead of only when data is returned, rendering it useless.

This results in whichever process reads stdin getting stuck on shutdown, which previously forced us to kill the entire server process to make it go away.

To get around this problem, we delegate the responsibility of reading stdin to a subprocess, which we can then brutally murder when the server shuts down, without killing the entire server process. Thankfully, stream_select() actually works properly on sockets, so we can use them for inter-process communication.

Definition at line 57 of file ConsoleReaderChildProcessDaemon.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\console\ConsoleReaderChildProcessDaemon::__construct ( \Logger $logger)

Definition at line 68 of file ConsoleReaderChildProcessDaemon.php.

Member Function Documentation

◆ quit()

pocketmine\console\ConsoleReaderChildProcessDaemon::quit ( )

Definition at line 142 of file ConsoleReaderChildProcessDaemon.php.

◆ readLine()

pocketmine\console\ConsoleReaderChildProcessDaemon::readLine ( )

Definition at line 106 of file ConsoleReaderChildProcessDaemon.php.

Member Data Documentation

◆ TOKEN_DELIMITER

const pocketmine\console\ConsoleReaderChildProcessDaemon::TOKEN_DELIMITER = ":"

Definition at line 58 of file ConsoleReaderChildProcessDaemon.php.

◆ TOKEN_HASH_ALGO

const pocketmine\console\ConsoleReaderChildProcessDaemon::TOKEN_HASH_ALGO = "xxh3"

Definition at line 59 of file ConsoleReaderChildProcessDaemon.php.


The documentation for this class was generated from the following file: