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

Integrates submodule v0.7

parent 48715a52
No related branches found
No related tags found
No related merge requests found
...@@ -141,7 +141,6 @@ CtaAdminCmd::CtaAdminCmd(int argc, const char *const *const argv) : ...@@ -141,7 +141,6 @@ CtaAdminCmd::CtaAdminCmd(int argc, const char *const *const argv) :
void CtaAdminCmd::send() const void CtaAdminCmd::send() const
{ {
// Validate the Protocol Buffer // Validate the Protocol Buffer
try { try {
validateCmd(m_request.admincmd()); validateCmd(m_request.admincmd());
} catch(std::runtime_error &ex) { } catch(std::runtime_error &ex) {
...@@ -149,22 +148,23 @@ void CtaAdminCmd::send() const ...@@ -149,22 +148,23 @@ void CtaAdminCmd::send() const
} }
// Get socket address of CTA Frontend endpoint // Get socket address of CTA Frontend endpoint
cta::cmdline::Configuration cliConf("/etc/cta/cta-cli.conf"); cta::cmdline::Configuration cliConf("/etc/cta/cta-cli.conf");
std::string endpoint = cliConf.getFrontendHostAndPort(); std::string endpoint = cliConf.getFrontendHostAndPort();
// Obtain a Service Provider // Set configuration options
XrdSsiPb::Config config;
config.set("response_bufsize", StreamBufferSize);
config.set("request_timeout", DefaultRequestTimeout);
config.getEnv("request_timeout", "XRD_REQUESTTIMEOUT");
XrdSsiPbServiceType cta_service(endpoint, Resource, StreamBufferSize, GetRequestTimeout()); // Obtain a Service Provider
XrdSsiPbServiceType cta_service(endpoint, Resource, config);
// Send the Request to the Service and get a Response // Send the Request to the Service and get a Response
cta::xrd::Response response; cta::xrd::Response response;
auto stream_future = cta_service.Send(m_request, response); auto stream_future = cta_service.Send(m_request, response);
// Handle responses // Handle responses
switch(response.type()) switch(response.type())
{ {
using namespace cta::xrd; using namespace cta::xrd;
...@@ -288,20 +288,6 @@ void CtaAdminCmd::throwUsage(const std::string &error_txt) const ...@@ -288,20 +288,6 @@ void CtaAdminCmd::throwUsage(const std::string &error_txt) const
throw std::runtime_error(help.str()); 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;
return request_timeout;
}
}} // namespace cta::admin }} // namespace cta::admin
......
...@@ -58,13 +58,13 @@ private: ...@@ -58,13 +58,13 @@ private:
/* /*
* Member variables * Member variables
*/ */
const std::string Resource = "/ctafrontend"; //!< XRootD SSI Resource name const std::string Resource = "/ctafrontend"; //!< XRootD SSI Resource name
const int StreamBufferSize = 1024; //!< Buffer size for Data/Stream Responses const std::string StreamBufferSize = "1024"; //!< Buffer size for Data/Stream Responses
const int DefaultRequestTimeout = 10; //!< Default Request Timeout. Can be overridden by const std::string DefaultRequestTimeout = "10"; //!< Default Request Timeout. Can be overridden by
//!< XRD_REQUESTTIMEOUT environment variable. //!< XRD_REQUESTTIMEOUT environment variable.
std::string m_execname; //!< Executable name of this program std::string m_execname; //!< Executable name of this program
cta::xrd::Request m_request; //!< Protocol Buffer for the command and parameters cta::xrd::Request m_request; //!< Protocol Buffer for the command and parameters
static constexpr const char* const LOG_SUFFIX = "CtaAdminCmd"; //!< Identifier for log messages static constexpr const char* const LOG_SUFFIX = "CtaAdminCmd"; //!< Identifier for log messages
}; };
......
Subproject commit bb95ae8b5acfc8424b6a5537a5738bd92b4dfb2a Subproject commit abdb133901fb9451a27e941910a5a2228117ce99
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