@@ -58,7 +58,7 @@ bool WebsocketPlain::connect() {
58
58
if (this ->m_is_connected ) {
59
59
try {
60
60
EVLOG_info << " Closing websocket connection before reconnecting" ;
61
- this ->ws_client .close (this ->handle , websocketpp:: close ::status:: normal , " " );
61
+ this ->ws_client .close (this ->handle , WebsocketCloseReason::Normal , " " );
62
62
} catch (std::exception & e) {
63
63
EVLOG_error << " Error on plain close: " << e.what ();
64
64
}
@@ -107,7 +107,7 @@ void WebsocketPlain::reconnect(std::error_code reason, long delay) {
107
107
if (this ->m_is_connected ) {
108
108
try {
109
109
EVLOG_info << " Closing websocket connection before reconnecting" ;
110
- this ->ws_client .close (this ->handle , websocketpp:: close ::status:: normal , " " );
110
+ this ->ws_client .close (this ->handle , WebsocketCloseReason::Normal , " " );
111
111
} catch (std::exception & e) {
112
112
EVLOG_error << " Error on plain close: " << e.what ();
113
113
}
@@ -125,7 +125,7 @@ void WebsocketPlain::reconnect(std::error_code reason, long delay) {
125
125
// TODO(kai): complete error handling, especially making sure that a reconnect is only attempted in reasonable
126
126
// circumstances
127
127
switch (reason.value ()) {
128
- case websocketpp:: close ::status::force_tcp_drop :
128
+ case WebsocketCloseReason::ForceTcpDrop :
129
129
/* code */
130
130
break ;
131
131
@@ -223,7 +223,7 @@ void WebsocketPlain::on_close_plain(client* c, websocketpp::connection_hdl hdl)
223
223
<< websocketpp::close::status::get_string (con->get_remote_close_code ())
224
224
<< " ), reason: " << con->get_remote_close_reason ();
225
225
// dont reconnect on normal code
226
- if (con->get_remote_close_code () != websocketpp:: close ::status:: normal ) {
226
+ if (con->get_remote_close_code () != WebsocketCloseReason::Normal ) {
227
227
this ->reconnect (error_code, this ->get_reconnect_interval ());
228
228
} else {
229
229
this ->closed_callback (con->get_remote_close_code ());
@@ -246,11 +246,11 @@ void WebsocketPlain::on_fail_plain(client* c, websocketpp::connection_hdl hdl) {
246
246
this ->connection_attempts <= this ->connection_options .max_connection_attempts ) {
247
247
this ->reconnect (ec, this ->get_reconnect_interval ());
248
248
} else {
249
- this ->close (websocketpp:: close ::status:: normal , " Connection failed" );
249
+ this ->close (WebsocketCloseReason::Normal , " Connection failed" );
250
250
}
251
251
}
252
252
253
- void WebsocketPlain::close (websocketpp::close::status::value code, const std::string& reason) {
253
+ void WebsocketPlain::close (WebsocketCloseReason code, const std::string& reason) {
254
254
EVLOG_info << " Closing plain websocket." ;
255
255
websocketpp::lib::error_code ec;
256
256
this ->cancel_reconnect_timer ();
@@ -260,7 +260,7 @@ void WebsocketPlain::close(websocketpp::close::status::value code, const std::st
260
260
if (ec) {
261
261
EVLOG_error << " Error initiating close of plain websocket: " << ec.message ();
262
262
// on_close_plain won't be called here so we have to call the closed_callback manually
263
- this ->closed_callback (websocketpp:: close ::status::abnormal_close );
263
+ this ->closed_callback (WebsocketCloseReason::AbnormalClose );
264
264
} else {
265
265
EVLOG_info << " Closed plain websocket successfully." ;
266
266
}
0 commit comments