@@ -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 (
@@ -474,7 +492,7 @@ _mongoc_get_rr_search (const char *service,
474
492
DNS_ERROR ("Failed to look up %s record \"%s\": %s" ,
475
493
rr_type_name ,
476
494
service ,
477
- strerror (h_errno ));
495
+ _mongoc_hstrerror (h_errno ));
478
496
}
479
497
} while (size >= buffer_size );
480
498
@@ -495,7 +513,7 @@ _mongoc_get_rr_search (const char *service,
495
513
i ,
496
514
rr_type_name ,
497
515
service ,
498
- strerror (h_errno ));
516
+ _mongoc_hstrerror (h_errno ));
499
517
}
500
518
501
519
/* Skip records that don't match the ones we requested. CDRIVER-3628 shows
0 commit comments