Sfoglia il codice sorgente

Gateway/Worker keys

walkor 10 anni fa
parent
commit
55a3230840
2 ha cambiato i file con 6 aggiunte e 6 eliminazioni
  1. 3 3
      GatewayWorker/Gateway.php
  2. 3 3
      GatewayWorker/Lib/Gateway.php

+ 3 - 3
GatewayWorker/Gateway.php

@@ -275,7 +275,7 @@ class Gateway extends Worker
      */
     protected function storeClientAddress($global_client_id, $address)
     {
-        if(!Store::instance('gateway')->set('gateway-'.$global_client_id, $address))
+        if(!Store::instance('gateway')->set('client_id-'.$global_client_id, $address))
         {
             $msg = 'storeClientAddress fail.';
             if(get_class(Store::instance('gateway')) == 'Memcached')
@@ -295,7 +295,7 @@ class Gateway extends Worker
      */
     protected function delClientAddress($global_client_id)
     {
-        Store::instance('gateway')->delete('gateway-'.$global_client_id);
+        Store::instance('gateway')->delete('client_id-'.$global_client_id);
     }
     
     /**
@@ -324,7 +324,7 @@ class Gateway extends Worker
      */
     protected function createGlobalClientId()
     {
-        $global_socket_key = 'GLOBAL_SOCKET_ID_KEY';
+        $global_socket_key = 'GLOBAL_CLIENT_ID_KEY';
         $store = Store::instance('gateway');
         $global_client_id = $store->increment($global_socket_key);
         if(!$global_client_id || $global_client_id > 2147483646)

+ 3 - 3
GatewayWorker/Lib/Gateway.php

@@ -88,7 +88,7 @@ class Gateway
     */
    public static function isOnline($client_id)
    {
-       $address = Store::instance('gateway')->get('gateway-'.$client_id);
+       $address = Store::instance('gateway')->get('client_id-'.$client_id);
        if(!$address)
        {
            return 0;
@@ -164,7 +164,7 @@ class Gateway
        // 不是发给当前用户则使用存储中的地址
        else
        {
-           $address = Store::instance('gateway')->get('gateway-'.$client_id);
+           $address = Store::instance('gateway')->get('client_id-'.$client_id);
            if(!$address)
            {
                return false;
@@ -212,7 +212,7 @@ class Gateway
        }
        else
        {
-           $address = Store::instance('gateway')->get('gateway-'.$client_id);
+           $address = Store::instance('gateway')->get('client_id-'.$client_id);
            if(!$address)
            {
                return false;