Skip to content

Commit

Permalink
add const cast for old mongoc versions
Browse files Browse the repository at this point in the history
  • Loading branch information
fdr400 committed Oct 26, 2024
1 parent 871762d commit c6904ad
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mongo/src/storages/mongo/cdriver/pool_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,21 @@ std::string CreateTopologyChangeMessage(const mongoc_apm_topology_changed_t* eve

mongoc_read_prefs_t* prefs = mongoc_read_prefs_new(MONGOC_READ_SECONDARY);

#if MONGOC_CHECK_VERSION(1, 17, 0)
if (mongoc_topology_description_has_readable_server(new_td, prefs)) {
#else
if (mongoc_topology_description_has_readable_server(const_cast<mongoc_topology_description_t*>(new_td), prefs)) {
#endif
topology_msg.append("\nSecondary AVAILABLE\n");
} else {
topology_msg.append("\nSecondary UNAVAILABLE\n");
}

#if MONGOC_CHECK_VERSION(1, 17, 0)
if (mongoc_topology_description_has_writable_server(new_td)) {
#else
if (mongoc_topology_description_has_writable_server(const_cast<mongoc_topology_description_t*>(new_td))) {
#endif
topology_msg.append("Primary AVAILABLE");
} else {
topology_msg.append("Primary UNAVAILABLE");
Expand Down

0 comments on commit c6904ad

Please sign in to comment.