Skip to content

Commit 342825a

Browse files
committed
cluster: ignore extra commas in contact points string
The extra commas provided by the user should be ignored. In addition, if the user passed an empty contact points string, the internal contact points should be cleared. These changes are necessary for ConfigTests to pass.
1 parent db4ca4e commit 342825a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scylla-rust-wrapper/src/cluster.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,10 @@ unsafe fn cluster_set_contact_points(
189189
let mut contact_points = ptr_to_cstr_n(contact_points_raw, contact_points_length)
190190
.ok_or(CassError::CASS_ERROR_LIB_BAD_PARAMS)?
191191
.split(',')
192+
.filter(|s| !s.is_empty()) // Extra commas should be ignored.
192193
.peekable();
193194

194-
if contact_points.peek().is_none() {
195+
if contact_points.peek().is_none() || contact_points.peek().unwrap().is_empty() {
195196
// If cass_cluster_set_contact_points() is called with empty
196197
// set of contact points, the contact points should be cleared.
197198
cluster.contact_points.clear();

0 commit comments

Comments
 (0)