improve atomically async_reconnect.

This commit is contained in:
Gitea
2019-04-26 15:42:34 +08:00
parent 82fb3fb800
commit 9a8362d0ed
2 changed files with 47 additions and 11 deletions
+16
View File
@@ -281,7 +281,23 @@ void test_call_with_timeout() {
std::cin >> str;
}
void test_connect(){
rpc_client client;
client.set_error_callback([&client] (boost::system::error_code ex) {
client.async_reconnect();
});
bool r = client.connect("127.0.0.1", 9000);
if (!r) {
client.async_reconnect();
}
std::string str;
std::cin >> str;
}
int main() {
test_connect();
test_call_with_timeout();
test_sync_client();
test_async_client();