From 9243710ca372de26823c2225c7b46b072458c671 Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期五, 28 五月 2021 17:18:33 +0800 Subject: [PATCH] tcp proxy requests, need more test. --- utest/api_test.cpp | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/utest/api_test.cpp b/utest/api_test.cpp index 3d842bf..bddcbf7 100644 --- a/utest/api_test.cpp +++ b/utest/api_test.cpp @@ -206,7 +206,7 @@ } printf("\n"); }; - { + if (0) { // query procs std::string dest(BHAddress().SerializeAsString()); MsgQueryProc query; @@ -224,14 +224,21 @@ // printf("register topic : %s\n", r ? "ok" : "failed"); // Sleep(1s); } - { + for (int i = 0; i < 3; ++i) { // query procs with normal topic request MsgRequestTopic req; req.set_topic("#center_query_procs"); // req.set_data("{\"proc_id\":\"#center.node\"}"); std::string s(req.SerializeAsString()); // Sleep(10ms, false); - std::string dest(BHAddress().SerializeAsString()); + BHAddress host; + printf("query with ip set\n"); + host.set_ip("127.0.0.1"); + host.set_port(kBHCenterPort); + host.set_mq_id(1000011); + host.set_abs_addr(10296); + + std::string dest(host.SerializeAsString()); void *proc_id = 0; int proc_id_len = 0; DEFER1(BHFree(proc_id, proc_id_len);); @@ -247,7 +254,7 @@ } else { MsgRequestTopicReply ret; ret.ParseFromArray(reply, reply_len); - printf("topic query proc : %s\n", ret.data().c_str()); + printf("\ntopic query proc : %s\n", ret.data().c_str()); // MsgQueryProcReply result; // if (result.ParseFromArray(ret.data().data(), ret.data().size()) && IsSuccess(result.errmsg().errcode())) { // PrintProcs(result); @@ -325,7 +332,7 @@ for (int i = 0; i < 1; ++i) { MsgPublish pub; pub.set_topic(topic_ + std::to_string(i)); - pub.set_data("pub_data_" + std::string(1024 * 1, 'a')); + pub.set_data("pub_data_" + std::string(104 * 1, 'a')); std::string s(pub.SerializeAsString()); BHPublish(s.data(), s.size(), 0); // Sleep(1s); -- Gitblit v1.8.0