mirror of
https://github.com/qicosmos/rest_rpc.git
synced 2026-08-30 09:00:48 +08:00
improve atomically async_reconnect.
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user