@@ -101,7 +101,11 @@ _mongoc_client_killcursors_command (mongoc_cluster_t *cluster,
101
101
} while (0)
102
102
103
103
104
- #ifdef MONGOC_HAVE_DNSAPI
104
+ #if MONGOC_ENABLE_SRV == 0 // ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ ENABLE_SRV disabled
105
+
106
+ /* SRV support is disabled */
107
+
108
+ #elif defined(MONGOC_HAVE_DNSAPI ) // ↑↑↑ ENABLE_SRV disabled / Win32 Dnsapi ↓↓↓↓
105
109
106
110
typedef bool (* mongoc_rr_callback_t ) (const char * hostname ,
107
111
PDNS_RECORD pdns ,
@@ -291,7 +295,9 @@ _mongoc_get_rr_dnsapi (const char *hostname,
291
295
RETURN (dns_success && callback_success );
292
296
}
293
297
294
- #elif (defined(MONGOC_HAVE_RES_NSEARCH ) || defined(MONGOC_HAVE_RES_SEARCH ))
298
+ #elif ( \
299
+ defined(MONGOC_HAVE_RES_NSEARCH ) || \
300
+ defined(MONGOC_HAVE_RES_SEARCH )) // ↑↑↑↑↑↑↑ Win32 Dnsapi / resolv ↓↓↓↓↓↓↓↓
295
301
296
302
typedef bool (* mongoc_rr_callback_t ) (const char * hostname ,
297
303
ns_msg * ns_answer ,
@@ -569,7 +575,7 @@ _mongoc_get_rr_search (const char *hostname,
569
575
#endif
570
576
RETURN (dns_success && callback_success );
571
577
}
572
- #endif
578
+ #endif // ↑↑↑↑↑↑↑↑↑↑↑↑↑ resolv
573
579
574
580
/*
575
581
*--------------------------------------------------------------------------
@@ -605,17 +611,20 @@ _mongoc_client_get_rr (const char *hostname,
605
611
{
606
612
BSON_ASSERT (rr_data );
607
613
608
- #ifdef MONGOC_HAVE_DNSAPI
609
- return _mongoc_get_rr_dnsapi (hostname , rr_type , rr_data , error );
610
- #elif (defined(MONGOC_HAVE_RES_NSEARCH ) || defined(MONGOC_HAVE_RES_SEARCH ))
611
- return _mongoc_get_rr_search (
612
- hostname , rr_type , rr_data , initial_buffer_size , error );
613
- #else
614
+ #if MONGOC_ENABLE_SRV == 0
615
+ // Disabled
614
616
bson_set_error (error ,
615
617
MONGOC_ERROR_STREAM ,
616
618
MONGOC_ERROR_STREAM_NAME_RESOLUTION ,
617
619
"libresolv unavailable, cannot use mongodb+srv URI" );
618
620
return false;
621
+ #elif defined(MONGOC_HAVE_DNSAPI )
622
+ return _mongoc_get_rr_dnsapi (hostname , rr_type , rr_data , error );
623
+ #elif (defined(MONGOC_HAVE_RES_NSEARCH ) || defined(MONGOC_HAVE_RES_SEARCH ))
624
+ return _mongoc_get_rr_search (
625
+ hostname , rr_type , rr_data , initial_buffer_size , error );
626
+ #else
627
+ #error No SRV library is available, but ENABLE_SRV is true!
619
628
#endif
620
629
}
621
630
0 commit comments