@@ -299,6 +299,24 @@ typedef bool (*mongoc_rr_callback_t) (const char *service,
299
299
mongoc_rr_data_t * rr_data ,
300
300
bson_error_t * error );
301
301
302
+ static const char *
303
+ _mongoc_hstrerror (int code )
304
+ {
305
+ switch (code ) {
306
+ case HOST_NOT_FOUND :
307
+ return "The specified host is unknown." ;
308
+ case NO_ADDRESS :
309
+ return "The requested name is valid but does not have an IP address." ;
310
+ case NO_RECOVERY :
311
+ return "A nonrecoverable name server error occurred." ;
312
+ case TRY_AGAIN :
313
+ return "A temporary error occurred on an authoritative name server. Try "
314
+ "again later." ;
315
+ default :
316
+ return "An unknown error occurred." ;
317
+ }
318
+ }
319
+
302
320
static bool
303
321
srv_callback (const char * service ,
304
322
ns_msg * ns_answer ,
@@ -328,7 +346,7 @@ srv_callback (const char *service,
328
346
if (size < 1 ) {
329
347
DNS_ERROR ("Invalid record in SRV answer for \"%s\": \"%s\"" ,
330
348
service ,
331
- strerror (h_errno ));
349
+ _mongoc_hstrerror (h_errno ));
332
350
}
333
351
334
352
if (!_mongoc_host_list_from_hostport_with_err (
@@ -473,7 +491,7 @@ _mongoc_get_rr_search (const char *service,
473
491
DNS_ERROR ("Failed to look up %s record \"%s\": %s" ,
474
492
rr_type_name ,
475
493
service ,
476
- strerror (h_errno ));
494
+ _mongoc_hstrerror (h_errno ));
477
495
}
478
496
} while (size >= buffer_size );
479
497
@@ -494,7 +512,7 @@ _mongoc_get_rr_search (const char *service,
494
512
i ,
495
513
rr_type_name ,
496
514
service ,
497
- strerror (h_errno ));
515
+ _mongoc_hstrerror (h_errno ));
498
516
}
499
517
500
518
/* Skip records that don't match the ones we requested. CDRIVER-3628 shows
0 commit comments