Skip to content

Commit 8ce83dc

Browse files
fix: don't allow user to change ws mode on a connected cluster (this would be bad) (#778)
1 parent 6cebf6f commit 8ce83dc

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

include/dpp/cluster.h

+1
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ class DPP_EXPORT cluster {
273273
*
274274
* @param mode websocket protocol to use, either ws_json or ws_etf.
275275
* @return cluster& Reference to self for chaining.
276+
* @throw dpp::logic_exception If called after the cluster is started (this is not supported)
276277
*/
277278
cluster& set_websocket_protocol(websocket_protocol_t mode);
278279

src/dpp/cluster.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ request_queue* cluster::get_raw_rest() {
119119
}
120120

121121
cluster& cluster::set_websocket_protocol(websocket_protocol_t mode) {
122+
if (start_time > 0) {
123+
throw dpp::logic_exception("Cannot change websocket protocol on a started cluster!");
124+
}
122125
ws_mode = mode;
123126
return *this;
124127
}

0 commit comments

Comments
 (0)