This commit is contained in:
2020-08-31 01:39:28 +08:00
parent c044b8714e
commit aae29752d2
3 changed files with 12 additions and 3 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
{ {
"name": "framework/snowflake", "name": "game-worker/snowflake",
"description": "test framework", "description": "test framework",
"authors": [ "authors": [
{ {
+7 -2
View File
@@ -4,6 +4,7 @@ defined('APP_PATH') or define('APP_PATH', __DIR__ . '/../../');
use HttpServer\Http\Response; use HttpServer\Http\Response;
use Snowflake\Snowflake; use Snowflake\Snowflake;
use HttpServer\Http\Context;
if (!function_exists('make')) { if (!function_exists('make')) {
@@ -90,8 +91,12 @@ if (!function_exists('alias')) {
} }
if (!function_exists('name')) { if (!function_exists('name')) {
/**
* @param string $name
*/
function name($name) function name($name)
{ {
swoole_set_process_name($name); swoole_set_process_name($name);
@@ -107,10 +112,10 @@ if (!function_exists('response')) {
*/ */
function response() function response()
{ {
if (!Snowflake::has('response')) { if (!Context::hasContext('response')) {
return make('response', Response::class); return make('response', Response::class);
} }
return Snowflake::get()->response; return Context::getContext('response');
} }
} }
+4
View File
@@ -11,6 +11,7 @@ use Swoole\WebSocket\Frame;
return [ return [
'servers' => [ 'servers' => [
[ [
'id' => '',
'type' => Server::HTTP, 'type' => Server::HTTP,
'host' => '127.0.0.1', 'host' => '127.0.0.1',
'port' => 9527, 'port' => 9527,
@@ -26,6 +27,7 @@ return [
] ]
], ],
[ [
'id' => '',
'type' => Server::PACKAGE, 'type' => Server::PACKAGE,
'host' => '127.0.0.1', 'host' => '127.0.0.1',
'port' => 9628, 'port' => 9628,
@@ -45,6 +47,7 @@ return [
] ]
], ],
[ [
'id' => '',
'type' => Server::TCP, 'type' => Server::TCP,
'host' => '127.0.0.1', 'host' => '127.0.0.1',
'port' => 9629, 'port' => 9629,
@@ -68,6 +71,7 @@ return [
] ]
], ],
[ [
'id' => '',
'type' => Server::WEBSOCKET, 'type' => Server::WEBSOCKET,
'host' => '127.0.0.1', 'host' => '127.0.0.1',
'port' => 9530, 'port' => 9530,