From 5258347b46d72915490fa72747be677d436bdedd Mon Sep 17 00:00:00 2001
From: Michael Davis <michael.davis@cern.ch>
Date: Wed, 6 Sep 2017 16:33:02 +0200
Subject: [PATCH] [xrd_ssi] Changes constructor to use one parameter for
 endpoint

Previously took hostname and port as separate parameters, but they are
provided together in the config file so no point in separating them just
to recombine them.
---
 cmdline/EosCtaStub.cpp                     |  5 ++---
 xroot_ssi_pb/XrdSsiPbServiceClientSide.hpp | 16 ++++------------
 2 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/cmdline/EosCtaStub.cpp b/cmdline/EosCtaStub.cpp
index cbe58f14f7..0747314818 100644
--- a/cmdline/EosCtaStub.cpp
+++ b/cmdline/EosCtaStub.cpp
@@ -279,11 +279,10 @@ int exceptionThrowingMain(int argc, const char *const *const argv)
 
    // Obtain a Service Provider
 
-   std::string host("localhost");
-   int port = 10956;
+   std::string endpoint("localhost:10956");
    std::string resource("/ctafrontend");
 
-   XrdSsiPbServiceType cta_service(host, port, resource);
+   XrdSsiPbServiceType cta_service(endpoint, resource);
 
    // Send the Request to the Service and get a Response
 
diff --git a/xroot_ssi_pb/XrdSsiPbServiceClientSide.hpp b/xroot_ssi_pb/XrdSsiPbServiceClientSide.hpp
index a45d305efa..3a11e0b2b9 100644
--- a/xroot_ssi_pb/XrdSsiPbServiceClientSide.hpp
+++ b/xroot_ssi_pb/XrdSsiPbServiceClientSide.hpp
@@ -28,7 +28,6 @@
 /*!
  * XrdSsiProviderClient is instantiated and managed by the SSI library
  */
-
 extern XrdSsiProvider *XrdSsiProviderClient;
 
 
@@ -45,14 +44,11 @@ const unsigned int DefaultServerTimeout      = 15;         //!< Maximum XRootD r
 /*!
  * Convenience object to manage the XRootD SSI service on the client side
  */
-
 template <typename RequestType, typename MetadataType, typename AlertType>
 class ServiceClientSide
 {
 public:
-   ServiceClientSide() = delete;
-
-   ServiceClientSide(const std::string &hostname, unsigned int port, const std::string &resource,
+   ServiceClientSide(const std::string &endpoint, const std::string &resource,
                      unsigned int response_bufsize = DefaultResponseBufferSize,
                      unsigned int server_tmo       = DefaultServerTimeout);
 
@@ -76,12 +72,10 @@ private:
 /*!
  * Client-side Service Constructor
  */
-
 template <typename RequestType, typename MetadataType, typename AlertType>
 ServiceClientSide<RequestType, MetadataType, AlertType>::
-ServiceClientSide(const std::string &hostname, unsigned int port, const std::string &resource,
-                          unsigned int response_bufsize,
-                          unsigned int server_tmo) :
+ServiceClientSide(const std::string &endpoint, const std::string &resource,
+                  unsigned int response_bufsize, unsigned int server_tmo) :
    m_resource(resource),
    m_response_bufsize(response_bufsize),
    m_server_tmo(server_tmo)
@@ -112,7 +106,7 @@ ServiceClientSide(const std::string &hostname, unsigned int port, const std::str
 
    // Get the Service pointer
 
-   if(!(m_server_ptr = XrdSsiProviderClient->GetService(eInfo, hostname + ":" + std::to_string(port))))
+   if(!(m_server_ptr = XrdSsiProviderClient->GetService(eInfo, endpoint)))
    {
       throw XrdSsiException(eInfo);
    }
@@ -123,7 +117,6 @@ ServiceClientSide(const std::string &hostname, unsigned int port, const std::str
 /*!
  * Client-side Service Destructor
  */
-
 template <typename RequestType, typename MetadataType, typename AlertType>
 ServiceClientSide<RequestType, MetadataType, AlertType>::~ServiceClientSide()
 {
@@ -146,7 +139,6 @@ ServiceClientSide<RequestType, MetadataType, AlertType>::~ServiceClientSide()
 /*!
  * Send a Request to the Service
  */
-
 template <typename RequestType, typename MetadataType, typename AlertType>
 MetadataType ServiceClientSide<RequestType, MetadataType, AlertType>::Send(const RequestType &request)
 {
-- 
GitLab