diff --git a/cmdline/CtaAdminCmd.cpp b/cmdline/CtaAdminCmd.cpp index 3ab47a1c8c96def5b80e79f5a5c23fb91e4d6245..5245d70e71544622c76df244e9389c16c63e2b17 100644 --- a/cmdline/CtaAdminCmd.cpp +++ b/cmdline/CtaAdminCmd.cpp @@ -161,9 +161,7 @@ void CtaAdminCmd::send() const // Obtain a Service Provider - std::string resource("/ctafrontend"); - - XrdSsiPbServiceType cta_service(endpoint, resource); + XrdSsiPbServiceType cta_service(endpoint, Resource, StreamBufferSize, GetRequestTimeout()); // Send the Request to the Service and get a Response @@ -296,6 +294,23 @@ void CtaAdminCmd::throwUsage(const std::string &error_txt) const throw std::runtime_error(help.str()); } + + +int CtaAdminCmd::GetRequestTimeout() const +{ + const char *request_timeout_str = ::getenv("XRD_REQUESTTIMEOUT"); + + int request_timeout = request_timeout_str == nullptr ? DefaultRequestTimeout : atoi(request_timeout_str); + + // Use default if XRD_REQUESTTIMEOUT is not a valid positive integer + if(request_timeout <= 0) request_timeout = DefaultRequestTimeout; + +#ifdef XRDSSI_DEBUG + std::cerr << "[DEBUG] CtaAdminCmd::GetRequestTimeout(): Request timeout = " << request_timeout << "s" << std::endl; +#endif + return request_timeout; +} + }} // namespace cta::admin diff --git a/cmdline/CtaAdminCmd.hpp b/cmdline/CtaAdminCmd.hpp index 930b448566d0d8a6a04fb3d7e324cc7ffc58fd45..97d70f888c191a1c644f22904f9c75c76800076d 100644 --- a/cmdline/CtaAdminCmd.hpp +++ b/cmdline/CtaAdminCmd.hpp @@ -50,11 +50,21 @@ private: */ void throwUsage(const std::string &error_txt = "") const; + /*! + * Return the request timeout value (to pass to the ServiceClientSide constructor) + */ + int GetRequestTimeout() const; + /* * Member variables */ - std::string m_execname; //!< Executable name of this program - cta::xrd::Request m_request; //!< Protocol Buffer for the command and parameters + const std::string Resource = "/ctafrontend"; //!< XRootD SSI Resource name + const int StreamBufferSize = 1024; //!< Buffer size for Data/Stream Responses + const int DefaultRequestTimeout = 10; //!< Default Request Timeout. Can be overridden by + //!< XRD_REQUESTTIMEOUT environment variable. + + std::string m_execname; //!< Executable name of this program + cta::xrd::Request m_request; //!< Protocol Buffer for the command and parameters }; }} // namespace cta::admin diff --git a/eos_cta/CMakeLists.txt b/eos_cta/CMakeLists.txt index 3dfe6ff0b8e6ff18ec15a7d42da749ae4d65214f..f1579decef1ad56eda4eb49fb96c5e4eb25db0fd 100644 --- a/eos_cta/CMakeLists.txt +++ b/eos_cta/CMakeLists.txt @@ -16,7 +16,7 @@ cmake_minimum_required(VERSION 2.6) find_package(Protobuf3 REQUIRED) -set(PROTOBUF3_INCLUDE_PATH ${XRD_SSI_PB_DIR}/eos_cta/protobuf/) +set(PROTOBUF3_INCLUDE_PATH ${XRD_SSI_PB_DIR}/eos_cta/protobuf) file(GLOB ProtoFiles "${PROTOBUF3_INCLUDE_PATH}/*.proto") PROTOBUF3_GENERATE_CPP(ProtoSources ProtoHeaders ${ProtoFiles})