Skip to content
This repository was archived by the owner on Aug 2, 2020. It is now read-only.

Commit afaf769

Browse files
committed
Add config ws_reverse_reconnect_on_code_1000
1 parent a5e882f commit afaf769

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

src/conf/config_struct.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct Config {
3131
std::string ws_reverse_api_url = "";
3232
std::string ws_reverse_event_url = "";
3333
unsigned long ws_reverse_reconnect_interval = 3000;
34+
bool ws_reverse_reconnect_on_code_1000 = false;
3435
bool use_ws_reverse = false;
3536
std::string post_url = "";
3637
std::string access_token = "";

src/conf/loader.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ optional<Config> load_configuration(const string &filepath) {
101101
GET_CONFIG(ws_reverse_api_url, string);
102102
GET_CONFIG(ws_reverse_event_url, string);
103103
GET_CONFIG(ws_reverse_reconnect_interval, unsigned long);
104+
GET_BOOL_CONFIG(ws_reverse_reconnect_on_code_1000);
104105
GET_BOOL_CONFIG(use_ws_reverse);
105106
GET_CONFIG(post_url, string);
106107
GET_CONFIG(access_token, string);

src/service/impl/ws_reverse_service_class.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ shared_ptr<WsClientT> WsReverseService::SubServiceBase::init_ws_reverse_client(c
1414
}
1515
client->on_close = [&](shared_ptr<typename WsClientT::Connection> connection,
1616
int code, string reason) {
17-
if (code != 1000) {
17+
if (config.ws_reverse_reconnect_on_code_1000 || code != 1000) {
1818
with_unique_lock(should_reconnect_mutex_, [&]() {
1919
should_reconnect_ = true;
2020
});

0 commit comments

Comments
 (0)