Updated logic for stripping of endpoint

This commit is contained in:
Arches 2016-09-26 11:56:04 +02:00
parent e37cb46922
commit a5d2140793
1 changed files with 4 additions and 4 deletions

View File

@ -24,12 +24,12 @@ using grpc::Channel;
etcd::Client::Client(std::string const & address) etcd::Client::Client(std::string const & address)
{ {
std::string stripped_address(address); std::string stripped_address;
std::string substr("http://"); std::string substr("://");
std::string::size_type i = stripped_address.find(substr); std::string::size_type i = address.find(substr);
if(i != std::string::npos) if(i != std::string::npos)
{ {
stripped_address.erase(i,substr.length()); stripped_address = address.substr(i+substr.length());
} }
std::shared_ptr<Channel> channel = grpc::CreateChannel(stripped_address, grpc::InsecureChannelCredentials()); std::shared_ptr<Channel> channel = grpc::CreateChannel(stripped_address, grpc::InsecureChannelCredentials());
stub_= KV::NewStub(channel); stub_= KV::NewStub(channel);