qicosmos / rest_rpc

modern C++(C++11), simple, easy to use rpc framework
MIT License
1.7k stars 370 forks source link

rpc_client 重复测试会崩溃 #13

Open famik opened 4 years ago

famik commented 4 years ago

写个死循环不断跑,到了一定时间,必定崩溃:

void test() {
  try {
    rpc_client client("127.0.0.1", 9000);
    bool r = client.connect();
    if (!r) {
      std::cout << "connect timeout" << std::endl;
      return;
    }

    {
      auto result = client.call<2000, std::string>("test", "Hello");
      std::cout << "test result: " << result << std::endl;
    }
  }
  catch (const std::exception & e) {
    std::cout << e.what() << std::endl;
  }
}

int main(int argc, const char * argv[]) {
    for (;;) {
      test();
      std::this_thread::sleep_for(std::chrono::milliseconds(1000));
    }
    return 0;
}
qicosmos commented 4 years ago

我晚点看一下。

qicosmos commented 4 years ago

问题已经修复,见#16 取最新代码即可。