From 11e9a00af28bee2db93333c4947d7da268293024 Mon Sep 17 00:00:00 2001 From: Aaron Date: Fri, 31 Aug 2012 10:22:02 -0700 Subject: [PATCH] [FileBackend] Clear swift connection on invalid HTTP responses. Change-Id: I1a42b1a4d5fea9ea9fa7b80f97f9b98c29041efb --- includes/filebackend/SwiftFileBackend.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 ) . "')" . -- 2.20.1