From c1f9888db7f0570987c7ffc3c8e78bc566c657e3 Mon Sep 17 00:00:00 2001 From: qicosmos Date: Tue, 27 Aug 2019 16:24:10 +0800 Subject: [PATCH] update --- examples/client/main.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/client/main.cpp b/examples/client/main.cpp index 4cc0b63..4289acf 100644 --- a/examples/client/main.cpp +++ b/examples/client/main.cpp @@ -407,8 +407,11 @@ void test_sub1() { std::thread thd1([&client, &stop] { while (true) { try { - int r = client.call("add", 2, 3); - std::cout << "add result: " << r << "\n"; + if (client.has_connected()) { + int r = client.call("add", 2, 3); + std::cout << "add result: " << r << "\n"; + } + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } catch (const std::exception& ex) {