From: Aaron Date: Fri, 31 Aug 2012 17:22:02 +0000 (-0700) Subject: [FileBackend] Clear swift connection on invalid HTTP responses. X-Git-Tag: 1.31.0-rc.0~22459^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22brouteur%22%2C%28%24id_rubrique%20?a=commitdiff_plain;h=11e9a00af28bee2db93333c4947d7da268293024;p=lhc%2Fweb%2Fwiklou.git [FileBackend] Clear swift connection on invalid HTTP responses. Change-Id: I1a42b1a4d5fea9ea9fa7b80f97f9b98c29041efb --- diff --git a/includes/filebackend/SwiftFileBackend.php b/includes/filebackend/SwiftFileBackend.php index 4d47302fbd..4ee02aacb8 100644 --- a/includes/filebackend/SwiftFileBackend.php +++ b/includes/filebackend/SwiftFileBackend.php @@ -1202,6 +1202,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 * @@ -1315,6 +1328,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 ) . "')" .