-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zhanglei28
committed
Oct 30, 2024
1 parent
1f69666
commit dbc36df
Showing
6 changed files
with
67 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,3 +37,7 @@ agent.pid | |
# debugger | ||
.gdb* | ||
/tests/MockServer/log.txt | ||
|
||
composer.phar | ||
composer.lock | ||
.phpunit.cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="tests/bootstrap.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
> | ||
<filter> | ||
<whitelist processUncoveredFilesFromWhitelist="true"> | ||
<directory suffix=".php">./src/</directory> | ||
<exclude> | ||
<directory suffix=".php">./src/Motan/PB</directory> | ||
</exclude> | ||
</whitelist> | ||
</filter> | ||
<testsuites> | ||
<testsuite name="Package Test Suite"> | ||
<directory suffix=".php">./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="tests/bootstrap.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false"> | ||
<testsuites> | ||
<testsuite name="Package Test Suite"> | ||
<directory suffix=".php">./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
<source> | ||
<include> | ||
<directory suffix=".php">./src/</directory> | ||
</include> | ||
<exclude> | ||
<directory suffix=".php">./src/Motan/PB</directory> | ||
</exclude> | ||
</source> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,11 +21,11 @@ | |
|
||
/** | ||
* TCP Connection for PHP 5.6+ | ||
* | ||
* | ||
* <pre> | ||
* TCP 连接 | ||
* </pre> | ||
* | ||
* | ||
* @author idevz <[email protected]> | ||
* @version V1.0 [created at: 2016-11-18] | ||
*/ | ||
|
@@ -74,14 +74,14 @@ private function _initConnection() | |
} | ||
} | ||
if (!$connection) { | ||
throw new \Exception("Connect to $this->_connection_addr fail, err_code:${err_code},err_msg:${err_msg} "); | ||
throw new \Exception("Connect to $this->_connection_addr fail, err_code:{$err_code},err_msg:{$err_msg} "); | ||
} | ||
$this->_connection = $connection; | ||
$this->_setStreamOpt(); | ||
return true; | ||
} | ||
|
||
private function _setStreamOpt() | ||
private function _setStreamOpt() | ||
{ | ||
if (!is_resource($this->_connection)) { | ||
return false; | ||
|
@@ -102,7 +102,7 @@ public function write($buffer) | |
$sent = @fwrite($this->_connection, $buffer, $length); | ||
if ($sent === false) { | ||
$stream_meta = stream_get_meta_data($this->_connection); | ||
if($stream_meta['timed_out'] == TRUE) { | ||
if ($stream_meta['timed_out'] == TRUE) { | ||
throw new \Exception('Write to remote timeout.'); | ||
} else { | ||
throw new \Exception('Unknow error when write to remote. Stream detail:' . var_export($stream_meta, TRUE)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters