replace abandon_server with disconnect_and_reconnect
This commit is contained in:
@@ -108,10 +108,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void abandon_server() {
|
||||
void disconnect_and_reconnect() {
|
||||
if (channel_)
|
||||
{
|
||||
set_initial_state_standalone();
|
||||
eng::string target = channel_->target();
|
||||
set_initial_state_connect(target);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +139,7 @@ public:
|
||||
// An ack is just a single byte, so there's nothing left to read.
|
||||
if (unack_.empty()) {
|
||||
// Invalid acknowledgement when theres' nothing in the unack queue.
|
||||
abandon_server();
|
||||
disconnect_and_reconnect();
|
||||
return;
|
||||
}
|
||||
world_to_synchronous();
|
||||
@@ -158,7 +159,7 @@ public:
|
||||
}
|
||||
// dbc.dump(...);
|
||||
} catch (const StreamException &sexcept) {
|
||||
abandon_server();
|
||||
disconnect_and_reconnect();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -179,11 +180,11 @@ public:
|
||||
} else if (message_type == util::MSG_DIFF) {
|
||||
receive_diff_from_server(&body);
|
||||
} else {
|
||||
abandon_server();
|
||||
disconnect_and_reconnect();
|
||||
return false;
|
||||
}
|
||||
if (!body.empty()) {
|
||||
abandon_server();
|
||||
disconnect_and_reconnect();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -248,7 +249,7 @@ public:
|
||||
if (channel_ != nullptr) {
|
||||
if (channel_->closed()) {
|
||||
util::dprint("server closed connection: ", channel_->error());
|
||||
abandon_server();
|
||||
disconnect_and_reconnect();
|
||||
} else {
|
||||
while (true) {
|
||||
if (!receive_message_from_server(channel_->in())) break;
|
||||
|
||||
Reference in New Issue
Block a user