reresolve hostname before reconnecting
This commit is contained in:
parent
eaff27fda3
commit
636596a2cf
|
@ -83,11 +83,11 @@ Bot::Bot(asio::any_io_executor executor, std::string_view name,
|
||||||
asio::awaitable<void> Bot::Protocol() {
|
asio::awaitable<void> Bot::Protocol() {
|
||||||
asio::ip::tcp::resolver resolver{executor};
|
asio::ip::tcp::resolver resolver{executor};
|
||||||
asio::ip::tcp::resolver::query query{server, "4000"};
|
asio::ip::tcp::resolver::query query{server, "4000"};
|
||||||
auto host = co_await resolver.async_resolve(query, asio::use_awaitable);
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
|
auto host = co_await resolver.async_resolve(query, asio::use_awaitable);
|
||||||
co_await asio::async_connect(socket, host, asio::use_awaitable);
|
co_await asio::async_connect(socket, host, asio::use_awaitable);
|
||||||
break;
|
break;
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
|
|
Loading…
Reference in a new issue