Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
logs
vendor
composer.lock
.buildpath
.project
.settings
Expand Down
11 changes: 9 additions & 2 deletions src/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,13 @@ class Worker
*/
public static $processTitle = 'WorkerMan';

/**
* Custom Protocols Root Namespace
*
* @var string
*/
public static $protocolRoot = 'Protocols\\';

/**
* After sending the stop command to the child process stopTimeout seconds,
* if the process is still living then forced to kill.
Expand Down Expand Up @@ -2290,11 +2297,11 @@ protected function parseSocketAddress() {
// Check application layer protocol class.
if (!isset(self::BUILD_IN_TRANSPORTS[$scheme])) {
$scheme = \ucfirst($scheme);
$this->protocol = \substr($scheme,0,1)==='\\' ? $scheme : 'Protocols\\' . $scheme;
$this->protocol = \substr($scheme,0,1)==='\\' ? $scheme : self::$protocolRoot . $scheme;
if (!\class_exists($this->protocol)) {
$this->protocol = "Workerman\\Protocols\\$scheme";
if (!\class_exists($this->protocol)) {
throw new Exception("class \\Protocols\\$scheme not exist");
throw new Exception("protocol $scheme not exist");
}
}

Expand Down