Skip to content

Commit

Permalink
router bind fix
Browse files Browse the repository at this point in the history
  • Loading branch information
walkor committed Oct 2, 2015
1 parent 9bcea66 commit 5b29594
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions GatewayWorker/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Gateway extends Worker
* 版本
* @var string
*/
const VERSION = '1.0.1';
const VERSION = '1.0.2';

/**
* 本机ip
Expand Down Expand Up @@ -303,11 +303,11 @@ public static function routerRand($worker_connections, $client_connection, $cmd,
*/
public static function routerBind($worker_connections, $client_connection, $cmd, $buffer)
{
if(!isset($client_connection->businessworker))
if(!isset($client_connection->businessworker_address) || !isset($worker_connections[$client_connection->businessworker_address]))
{
$client_connection->businessworker = $worker_connections[array_rand($worker_connections)];
$client_connection->businessworker_address = array_rand($worker_connections);
}
return $client_connection->businessworker;
return $worker_connections[$client_connection->businessworker_address];
}

/**
Expand Down

0 comments on commit 5b29594

Please sign in to comment.