Fix test failures due to ipv4/ipv6 mismatch
This commit is contained in:
parent
e58969fd93
commit
798a95fca2
|
@ -220,7 +220,7 @@ class RouteGuideClient {
|
|||
};
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
std::string server_address = routeguide::GetServerAddress();
|
||||
std::string server_address = "127.0.0.1:" + routeguide::GetServerPort();
|
||||
|
||||
std::cout << "Server Address: " << server_address << std::endl;
|
||||
|
||||
|
|
|
@ -44,14 +44,12 @@ std::string GetDbFileContent(int argc, char** argv) {
|
|||
return db.str();
|
||||
}
|
||||
|
||||
std::string GetServerAddress() {
|
||||
std::string server_host("0.0.0.0");
|
||||
std::string GetServerPort() {
|
||||
std::string server_port("50051");
|
||||
if (std::getenv("SERVER_PORT")) {
|
||||
server_port = std::getenv("SERVER_PORT");
|
||||
}
|
||||
std::string server_address = server_host + ":" + server_port;
|
||||
return server_address;
|
||||
return server_port;
|
||||
}
|
||||
|
||||
// A simple parser for the json db file. It requires the db file to have the
|
||||
|
|
|
@ -27,7 +27,7 @@ class Feature;
|
|||
|
||||
std::string GetDbFileContent(int argc, char** argv);
|
||||
|
||||
std::string GetServerAddress();
|
||||
std::string GetServerPort();
|
||||
|
||||
void ParseDb(const std::string& db, std::vector<Feature>* feature_list);
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ class RouteGuideImpl final : public RouteGuide::Service {
|
|||
};
|
||||
|
||||
void RunServer(const std::string& db_path) {
|
||||
std::string server_address = routeguide::GetServerAddress();
|
||||
std::string server_address = "[::]:" + routeguide::GetServerPort();
|
||||
|
||||
RouteGuideImpl service(db_path);
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
Err(_e) => 50051,
|
||||
};
|
||||
|
||||
let addr = format!("[::1]:{}", port).parse().unwrap();
|
||||
let addr = format!("[::]:{}", port).parse().unwrap();
|
||||
|
||||
println!("RouteGuideServer listening on: {}", addr);
|
||||
|
||||
|
|
Loading…
Reference in New Issue