From 0fbf6e62884e2f5ebc18cd95372dd45119f4dbce Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sun, 15 Jan 2012 22:21:51 +0000 Subject: [PATCH] * Killed an RTT in SwiftFileBackend::doStreamFile(). We already check existence in FileBackend::streamFile() * A few minor code cleanups and comment tweaks. --- includes/filerepo/backend/SwiftFileBackend.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/includes/filerepo/backend/SwiftFileBackend.php b/includes/filerepo/backend/SwiftFileBackend.php index 8b7602ba30..f3eee3dadc 100644 --- a/includes/filerepo/backend/SwiftFileBackend.php +++ b/includes/filerepo/backend/SwiftFileBackend.php @@ -25,9 +25,9 @@ class SwiftFileBackend extends FileBackend { /** @var CF_Connection */ protected $conn; // Swift connection handle + protected $connTTL = 120; // integer seconds protected $connStarted = 0; // integer UNIX timestamp protected $connContainers = array(); // container object cache - protected $connTTL = 120; // integer seconds protected $swiftProxyUser; // string @@ -367,7 +367,7 @@ class SwiftFileBackend extends FileBackend { return $status; } - // (c) Delete the container if empty + // (b) Delete the container if empty if ( $contObj->object_count == 0 ) { try { $this->deleteContainer( $fullCont ); @@ -503,15 +503,11 @@ class SwiftFileBackend extends FileBackend { try { $cont = $this->getContainer( $srcCont ); - $obj = $cont->get_object( $srcRel ); } catch ( NoSuchContainerException $e ) { $status->fatal( 'backend-fail-stream', $params['src'] ); return $status; - } catch ( NoSuchObjectException $e ) { - $status->fatal( 'backend-fail-stream', $params['src'] ); - return $status; - } catch ( IOException $e ) { - $status->fatal( 'backend-fail-stream', $params['src'] ); + } catch ( InvalidResponseException $e ) { + $status->fatal( 'backend-fail-connect', $this->name ); return $status; } catch ( Exception $e ) { // some other exception? $status->fatal( 'backend-fail-stream', $params['src'] ); @@ -521,9 +517,10 @@ class SwiftFileBackend extends FileBackend { try { $output = fopen( 'php://output', 'w' ); + $obj = new CF_Object( $cont, $srcRel, False, False ); // skip HEAD request $obj->stream( $output, $this->headersFromParams( $params ) ); - } catch ( InvalidResponseException $e ) { - $status->fatal( 'backend-fail-connect', $this->name ); + } catch ( InvalidResponseException $e ) { // 404? connection problem? + $status->fatal( 'backend-fail-stream', $params['src'] ); } catch ( Exception $e ) { // some other exception? $status->fatal( 'backend-fail-stream', $params['src'] ); $this->logException( $e, __METHOD__, $params ); -- 2.20.1