Skip to content
Snippets Groups Projects
Commit 89963c79 authored by Michael Davis's avatar Michael Davis
Browse files

[cta-admin] Sets request timeout from XRD_REQUESTTIMEOUT

Default now set to 10s. Note that XRD_TIMEOUTRESOLUTION must be set
<= 10s, otherwise timeout defaults to 15s.
parent d6505e7f
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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
......
......@@ -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})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment