diff options
author | David G. Quintas <dgq@google.com> | 2017-06-02 09:55:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-02 09:55:29 -0700 |
commit | 672f15fbdded8291d92d72bf3758cce51d81dc15 (patch) | |
tree | de7352d8aace752e0224a985212fb881f4e99e7f /src | |
parent | 28bdde34069889c73ee8cad1c3bcb782877e215b (diff) | |
parent | 94ab1b55bfb29e19f5972d58b5cb7c194b9ae070 (diff) |
Merge pull request #11143 from dgquintas/dns_server
Make ServerBuilder accept (dns:///) URIs instead of just dns names
Diffstat (limited to 'src')
-rw-r--r-- | src/cpp/server/server_builder.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index c849d2e5b4..e20e933374 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -172,8 +172,15 @@ ServerBuilder& ServerBuilder::SetResourceQuota( } ServerBuilder& ServerBuilder::AddListeningPort( - const grpc::string& addr, std::shared_ptr<ServerCredentials> creds, + const grpc::string& addr_uri, std::shared_ptr<ServerCredentials> creds, int* selected_port) { + const grpc::string uri_scheme = "dns:"; + grpc::string addr = addr_uri; + if (addr_uri.compare(0, uri_scheme.size(), uri_scheme) == 0) { + size_t pos = uri_scheme.size(); + while (addr_uri[pos] == '/') ++pos; // Skip slashes. + addr = addr_uri.substr(pos); + } Port port = {addr, creds, selected_port}; ports_.push_back(port); return *this; |