mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-02 03:37:44 +08:00
Fixed json rpc connection confused.(#1260)
This commit is contained in:
parent
076f420a07
commit
2dab5f3e0a
@ -3,6 +3,7 @@
|
|||||||
## Fixed
|
## Fixed
|
||||||
|
|
||||||
- [#1258](https://github.com/hyperf/hyperf/pull/1258) Fixed CRITICAL error that socket of process is unavailable when amqp send heartbeat failed.
|
- [#1258](https://github.com/hyperf/hyperf/pull/1258) Fixed CRITICAL error that socket of process is unavailable when amqp send heartbeat failed.
|
||||||
|
- [#1260](https://github.com/hyperf/hyperf/pull/1260) Fixed json rpc connection confused.
|
||||||
|
|
||||||
# v1.1.14 - 2010-01-10
|
# v1.1.14 - 2010-01-10
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ class JsonRpcPoolTransporter implements TransporterInterface
|
|||||||
*/
|
*/
|
||||||
public function getConnection(): RpcConnection
|
public function getConnection(): RpcConnection
|
||||||
{
|
{
|
||||||
$class = static::class . '.Connection';
|
$class = spl_object_hash($this) . '.Connection';
|
||||||
if (Context::has($class)) {
|
if (Context::has($class)) {
|
||||||
return Context::get($class);
|
return Context::get($class);
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ class JsonRpcTransporter implements TransporterInterface
|
|||||||
|
|
||||||
public function getClient(): SwooleClient
|
public function getClient(): SwooleClient
|
||||||
{
|
{
|
||||||
$class = static::class . '.Connection';
|
$class = spl_object_hash($this) . '.Connection';
|
||||||
if (Context::has($class)) {
|
if (Context::has($class)) {
|
||||||
return Context::get($class);
|
return Context::get($class);
|
||||||
}
|
}
|
||||||
|
@ -97,6 +97,18 @@ class JsonRpcPoolTransporterTest extends TestCase
|
|||||||
$this->assertSame($data, $packer->unpack($string));
|
$this->assertSame($data, $packer->unpack($string));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testsplObjectHash()
|
||||||
|
{
|
||||||
|
$class = new \stdClass();
|
||||||
|
$class->id = 1;
|
||||||
|
$hash = spl_object_hash($class);
|
||||||
|
|
||||||
|
$class->id = 2;
|
||||||
|
$hash2 = spl_object_hash($class);
|
||||||
|
|
||||||
|
$this->assertSame($hash, $hash2);
|
||||||
|
}
|
||||||
|
|
||||||
protected function getContainer()
|
protected function getContainer()
|
||||||
{
|
{
|
||||||
$container = Mockery::mock(Container::class);
|
$container = Mockery::mock(Container::class);
|
||||||
|
Loading…
Reference in New Issue
Block a user