@@ -124,7 +124,7 @@ mongoc_topology_scanner_add_and_scan (mongoc_topology_scanner_t *ts,
124
124
125
125
node = mongoc_topology_scanner_add (ts , host , id );
126
126
127
- if (node && mongoc_topology_scanner_node_setup (node )) {
127
+ if (node && mongoc_topology_scanner_node_setup (node , & node -> last_error )) {
128
128
node -> cmd = mongoc_async_cmd (
129
129
ts -> async , node -> stream , ts -> setup ,
130
130
node -> host .host , "admin" ,
@@ -405,23 +405,22 @@ mongoc_topology_scanner_node_connect_unix (mongoc_topology_scanner_node_t *node,
405
405
}
406
406
407
407
bool
408
- mongoc_topology_scanner_node_setup (mongoc_topology_scanner_node_t * node )
408
+ mongoc_topology_scanner_node_setup (mongoc_topology_scanner_node_t * node , bson_error_t * error )
409
409
{
410
410
mongoc_stream_t * sock_stream ;
411
- bson_error_t error = { 0 };
412
411
413
412
if (node -> stream ) { return true; }
414
413
415
414
BSON_ASSERT (!node -> retired );
416
415
417
416
if (node -> ts -> initiator ) {
418
417
sock_stream = node -> ts -> initiator (node -> ts -> uri , & node -> host ,
419
- node -> ts -> initiator_context , & error );
418
+ node -> ts -> initiator_context , error );
420
419
} else {
421
420
if (node -> host .family == AF_UNIX ) {
422
- sock_stream = mongoc_topology_scanner_node_connect_unix (node , & error );
421
+ sock_stream = mongoc_topology_scanner_node_connect_unix (node , error );
423
422
} else {
424
- sock_stream = mongoc_topology_scanner_node_connect_tcp (node , & error );
423
+ sock_stream = mongoc_topology_scanner_node_connect_tcp (node , error );
425
424
}
426
425
427
426
#ifdef MONGOC_ENABLE_SSL
@@ -433,7 +432,7 @@ mongoc_topology_scanner_node_setup (mongoc_topology_scanner_node_t *node)
433
432
434
433
if (!sock_stream ) {
435
434
/* Pass a rtt of -1 if we couldn't initialize a stream in node_setup */
436
- node -> ts -> cb (node -> id , NULL , -1 , node -> ts -> cb_data , & error );
435
+ node -> ts -> cb (node -> id , NULL , -1 , node -> ts -> cb_data , error );
437
436
return false;
438
437
}
439
438
@@ -491,7 +490,7 @@ mongoc_topology_scanner_start (mongoc_topology_scanner_t *ts,
491
490
{
492
491
/* check node if it last failed before current cooldown period began */
493
492
if (node -> last_failed < cooldown ) {
494
- if (mongoc_topology_scanner_node_setup (node )) {
493
+ if (mongoc_topology_scanner_node_setup (node , & node -> last_error )) {
495
494
496
495
BSON_ASSERT (!node -> cmd );
497
496
0 commit comments