Merge "[FileBackend] Clear swift connection on invalid HTTP responses."

This commit is contained in:
Demon 2012-09-05 19:14:09 +00:00 committed by Gerrit Code Review
commit b6fcfa633d

View file

@ -1218,6 +1218,19 @@ class SwiftFileBackend extends FileBackendStore {
return $this->conn;
}
/**
* Close the connection to the Swift proxy
*
* @return void
*/
protected function closeConnection() {
if ( $this->conn ) {
$this->conn->close(); // close active cURL handles in CF_Http object
$this->sessionStarted = 0;
$this->connContainerCache->clear();
}
}
/**
* Get the cache key for a container
*
@ -1331,6 +1344,7 @@ class SwiftFileBackend extends FileBackendStore {
}
if ( $e instanceof InvalidResponseException ) { // possibly a stale token
$this->srvCache->delete( $this->getCredsCacheKey( $this->auth->username ) );
$this->closeConnection(); // force a re-connect and re-auth next time
}
wfDebugLog( 'SwiftBackend',
get_class( $e ) . " in '{$func}' (given '" . FormatJson::encode( $params ) . "')" .