remove test change'

This commit is contained in:
yhz 2019-11-20 11:06:24 +08:00
parent b552b77a7e
commit a5a41212f8
5 changed files with 12 additions and 26 deletions

View File

@ -78,7 +78,7 @@ ClientTest::Test(const std::string &address, const std::string &port) {
stat = conn->Connect(param);
std::cout << "Connect function call status: " << stat.message() << std::endl;
}
#ifdef yhz
{ // create table
milvus::TableSchema tb_schema = BuildTableSchema();
stat = conn->CreateTable(tb_schema);
@ -202,5 +202,4 @@ ClientTest::Test(const std::string &address, const std::string &port) {
}
milvus::Connection::Destroy(conn);
#endif
}

View File

@ -36,7 +36,7 @@ main(int argc, char* argv[]) {
{nullptr, 0, nullptr, 0}};
int option_index = 0;
std::string address = "192.168.1.89", port = "19530";
std::string address = "127.0.0.1", port = "19530";
app_name = argv[0];
int value;

View File

@ -68,7 +68,7 @@ ClientTest::Test(const std::string& address, const std::string& port) {
stat = conn->Connect(param);
std::cout << "Connect function call status: " << stat.message() << std::endl;
}
#ifdef yhz
{ // server version
std::string version = conn->ServerVersion();
std::cout << "Server version: " << version << std::endl;
@ -206,5 +206,4 @@ ClientTest::Test(const std::string& address, const std::string& port) {
std::string status = conn->ServerStatus();
std::cout << "Server status after disconnect: " << status << std::endl;
}
#endif
}

View File

@ -43,28 +43,16 @@ Status
ClientProxy::Connect(const ConnectParam& param) {
std::string uri = param.ip_address + ":" + param.port;
// channel_ = ::grpc::CreateChannel(uri, ::grpc::InsecureChannelCredentials());
// channel_ = std::make_shared<grpc_channel>(grpc_insecure_channel_create(uri.c_str(), nullptr, nullptr));
// channel_ = std::shared_ptr<grpc_channel>(grpc_insecure_channel_create(uri.c_str(), nullptr, nullptr));
auto uri_str = uri.c_str();
grpc_channel * channel = grpc_insecure_channel_create(uri_str, nullptr, nullptr);
// grpc_insecure_channel_create(uri.c_str(), nullptr, nullptr);
auto state = grpc_channel_check_connectivity_state(channel, true);
if (state == GRPC_CHANNEL_READY) {
std::cout << "Connect " << uri << " successfully";
} else {
std::cout << "Connect " << uri << " failed.";
channel_ = ::grpc::CreateChannel(uri, ::grpc::InsecureChannelCredentials());
if (channel_ != nullptr) {
connected_ = true;
client_ptr_ = std::make_shared<GrpcClient>(channel_);
return Status::OK();
}
// if (channel_ != nullptr) {
// connected_ = true;
// client_ptr_ = std::make_shared<GrpcClient>(channel_);
// return Status::OK();
// }
// std::string reason = "connect failed!";
// connected_ = false;
// return Status(StatusCode::NotConnected, reason);
std::string reason = "connect failed!";
connected_ = false;
return Status(StatusCode::NotConnected, reason);
}
Status

View File

@ -105,7 +105,7 @@ class ClientProxy : public Connection {
DropPartition(const PartitionParam& partition_param) override;
private:
std::shared_ptr<grpc_channel> channel_;
std::shared_ptr<::grpc::Channel> channel_;
private:
std::shared_ptr<GrpcClient> client_ptr_;