// no handle given, receiving the latest issued
$serverKey = $this->associationServerKey($server_url);
// no handle given, receiving the latest issued
$serverKey = $this->associationServerKey($server_url);
- $lastKey = $this->redis->lpop($serverKey);
- if (!$lastKey) { return null; }
+ $lastKey = $this->redis->lindex($serverKey, -1);
+ if (!$lastKey) {
+ // no previous association with this server
+ return null;
+ }
// get association, return null if failed
return $this->getAssociationFromServer($lastKey);
// get association, return null if failed
return $this->getAssociationFromServer($lastKey);
// SETNX will set the value only of the key doesn't exist yet.
$nonceKey = $this->nonceKey($server_url, $salt);
// SETNX will set the value only of the key doesn't exist yet.
$nonceKey = $this->nonceKey($server_url, $salt);