abandon ongoing paged search before starting a new one

This commit is contained in:
Arthur Schiwon 2014-09-18 17:00:51 +02:00
parent 9a63693227
commit 53ec32807a
1 changed files with 3 additions and 4 deletions

View File

@ -1376,7 +1376,7 @@ class Access extends LDAPUtility implements user\IUserTools {
* resets a running Paged Search operation * resets a running Paged Search operation
*/ */
private function abandonPagedSearch() { private function abandonPagedSearch() {
if(count($this->cookies) > 0) { if(!empty($this->lastCookie)) {
$cr = $this->connection->getConnectionResource(); $cr = $this->connection->getConnectionResource();
$this->ldap->controlPagedResult($cr, 0, false, $this->lastCookie); $this->ldap->controlPagedResult($cr, 0, false, $this->lastCookie);
$this->getPagedSearchResultState(); $this->getPagedSearchResultState();
@ -1475,9 +1475,8 @@ class Access extends LDAPUtility implements user\IUserTools {
} }
} }
if(!is_null($cookie)) { if(!is_null($cookie)) {
if($offset > 0) { //since offset = 0, this is a new search. We abandon other searches that might be ongoing.
\OCP\Util::writeLog('user_ldap', 'Cookie '.CRC32($cookie), \OCP\Util::INFO); $this->abandonPagedSearch();
}
$pagedSearchOK = $this->ldap->controlPagedResult( $pagedSearchOK = $this->ldap->controlPagedResult(
$this->connection->getConnectionResource(), $limit, $this->connection->getConnectionResource(), $limit,
false, $cookie); false, $cookie);