Skip to content

Commit

Permalink
check that we dont try to change websocket mode on a connected cluste…
Browse files Browse the repository at this point in the history
…r (this would be Bad Times™)
  • Loading branch information
braindigitalis committed Aug 17, 2023
1 parent 6cebf6f commit 0cd5c0e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/dpp/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ class DPP_EXPORT cluster {
*
* @param mode websocket protocol to use, either ws_json or ws_etf.
* @return cluster& Reference to self for chaining.
* @throw dpp::logic_exception If called after the cluster is started (this is not supported)
*/
cluster& set_websocket_protocol(websocket_protocol_t mode);

Expand Down
3 changes: 3 additions & 0 deletions src/dpp/cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ request_queue* cluster::get_raw_rest() {
}

cluster& cluster::set_websocket_protocol(websocket_protocol_t mode) {
if (start_time > 0) {
throw dpp::logic_exception("Cannot change websocket protocol on a started cluster!");
}
ws_mode = mode;
return *this;
}
Expand Down

0 comments on commit 0cd5c0e

Please sign in to comment.