diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 7a069a0f3b9c87722cf34cf54ef9fa0c5b0b5e41..fa925b25d52b083578c2c1976bff0a819e5cecc4 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -81,6 +81,7 @@ set (COMMON_LIB_SRC_FILES exception/NoPortInRange.cpp exception/NotAnOwner.cpp exception/OutOfMemory.cpp + exception/TimeOut.cpp log/DummyLogger.cpp log/LogContext.cpp log/Logger.cpp diff --git a/tapeserver/castor/exception/TimeOut.cpp b/common/exception/TimeOut.cpp similarity index 93% rename from tapeserver/castor/exception/TimeOut.cpp rename to common/exception/TimeOut.cpp index 6a03b57aaf15459ef87b8536c39565a72a984c7b..4769e17b496030a184f9405986bfdbf12e532ddb 100644 --- a/tapeserver/castor/exception/TimeOut.cpp +++ b/common/exception/TimeOut.cpp @@ -22,10 +22,10 @@ * @author Castor Dev team, castor-dev@cern.ch *****************************************************************************/ -#include "castor/exception/TimeOut.hpp" +#include "common/exception/TimeOut.hpp" // ----------------------------------------------------------------------- // Constructor // ----------------------------------------------------------------------- -castor::exception::TimeOut::TimeOut() : +cta::exception::TimeOut::TimeOut() : cta::exception::Exception() {} diff --git a/tapeserver/castor/exception/TimeOut.hpp b/common/exception/TimeOut.hpp similarity index 96% rename from tapeserver/castor/exception/TimeOut.hpp rename to common/exception/TimeOut.hpp index d767c719aa432e56eb009f017731c8236bb5a59f..8690bb4498682f694c549f252825fdf79d3485ed 100644 --- a/tapeserver/castor/exception/TimeOut.hpp +++ b/common/exception/TimeOut.hpp @@ -27,7 +27,7 @@ // Include Files #include "common/exception/Exception.hpp" -namespace castor { +namespace cta { namespace exception { @@ -47,5 +47,5 @@ namespace castor { } // end of namespace exception -} // end of namespace castor +} // end of namespace cta diff --git a/tapeserver/castor/io/io.cpp b/tapeserver/castor/io/io.cpp index b82307b9d528dc1f7c4fe11bae905d01f89dbf96..c10b8d55399780f54f0a4e32ce89d178d66f4641 100644 --- a/tapeserver/castor/io/io.cpp +++ b/tapeserver/castor/io/io.cpp @@ -291,7 +291,7 @@ int castor::io::acceptConnection(const int listenSocketFd) //------------------------------------------------------------------------------ int castor::io::acceptConnection(const int listenSocketFd, const time_t timeout) throw( - castor::exception::TimeOut, + cta::exception::TimeOut, cta::exception::AcceptConnectionInterrupted, cta::exception::Exception) { @@ -317,7 +317,7 @@ int castor::io::acceptConnection(const int listenSocketFd, switch(pollRc) { case 0: // poll() timed out { - castor::exception::TimeOut ex; + cta::exception::TimeOut ex; ex.getMessage() << "Failed to accept connection: poll() timed out after " << timeout << " seconds whilst trying to accept a connection"; @@ -843,7 +843,7 @@ int castor::io::connectWithTimeout( const std::string &hostName, const unsigned short port, const int timeout) - throw(castor::exception::TimeOut, cta::exception::Exception) { + throw(cta::exception::TimeOut, cta::exception::Exception) { try { std::ostringstream portStream; portStream << port; @@ -906,7 +906,7 @@ int castor::io::connectWithTimeout( const struct sockaddr *address, const socklen_t address_len, const int timeout) - throw(castor::exception::TimeOut, cta::exception::Exception) { + throw(cta::exception::TimeOut, cta::exception::Exception) { // Create the socket for the new connection utils::SmartFd smartSock(socket(sockDomain, sockType, sockProtocol)); @@ -980,7 +980,7 @@ int castor::io::connectWithTimeout( // Throw a timed-out exception if poll() timed-out if(0 == pollRc) { - castor::exception::TimeOut ex; + cta::exception::TimeOut ex; ex.getMessage() << "Failed to connect" ": poll() timed out after " << timeout << " seconds"; diff --git a/tapeserver/castor/io/io.hpp b/tapeserver/castor/io/io.hpp index b37f556f0c0a01c602b16f0c4537bff53d5a93b4..34af4174e4e734fc701c26d8962a09acc9c3e852 100644 --- a/tapeserver/castor/io/io.hpp +++ b/tapeserver/castor/io/io.hpp @@ -27,7 +27,7 @@ #include "common/exception/AcceptConnectionInterrupted.hpp" #include "common/exception/InvalidArgument.hpp" #include "common/exception/NoPortInRange.hpp" -#include "castor/exception/TimeOut.hpp" +#include "common/exception/TimeOut.hpp" #include "castor/io/Constants.hpp" #include "castor/io/IpAndPort.hpp" #include "common/exception/Exception.hpp" @@ -207,7 +207,7 @@ int acceptConnection(const int listenSockFd) int acceptConnection( const int listenSockFd, const time_t timeout) - throw(castor::exception::TimeOut, + throw(cta::exception::TimeOut, cta::exception::AcceptConnectionInterrupted, cta::exception::Exception); @@ -363,7 +363,7 @@ int connectWithTimeout( const std::string &hostName, const unsigned short port, const int timeout) - throw(castor::exception::TimeOut, cta::exception::Exception); + throw(cta::exception::TimeOut, cta::exception::Exception); /** * Creates the specified socket and uses it to connect to the specified @@ -395,7 +395,7 @@ int connectWithTimeout( const struct sockaddr *address, const socklen_t address_len, const int timeout) - throw(castor::exception::TimeOut, cta::exception::Exception); + throw(cta::exception::TimeOut, cta::exception::Exception); /** * Marshals the specified src value into the specified destination buffer. diff --git a/tapeserver/castor/utils/CMakeLists.txt b/tapeserver/castor/utils/CMakeLists.txt index bad107984d4bbe2a76561d77056d8628addfa409..c547de49215bb59cbe99f14718b562ebab078c62 100644 --- a/tapeserver/castor/utils/CMakeLists.txt +++ b/tapeserver/castor/utils/CMakeLists.txt @@ -31,7 +31,6 @@ set (UTILS_LIB_SRC_FILES utils.cpp ../common/CastorConfiguration.cpp ../exception/Errnum.cpp - ../exception/TimeOut.cpp ../BaseObject.cpp ../Services.cpp ../Factories.cpp