@@ -1171,10 +1171,14 @@ _mongoc_cluster_add_node (mongoc_cluster_t *cluster,
1171
1171
sd -> id );
1172
1172
1173
1173
if (!scanner_node ) {
1174
- bson_set_error (error ,
1175
- MONGOC_ERROR_STREAM ,
1176
- MONGOC_ERROR_STREAM_NOT_ESTABLISHED ,
1177
- "Could not find node %s" , sd -> connection_address );
1174
+ if (sd -> error .code ) {
1175
+ memcpy (error , & sd -> error , sizeof * error );
1176
+ } else {
1177
+ bson_set_error (error ,
1178
+ MONGOC_ERROR_STREAM ,
1179
+ MONGOC_ERROR_STREAM_NOT_ESTABLISHED ,
1180
+ "Could not find node %s" , sd -> connection_address );
1181
+ }
1178
1182
RETURN (NULL );
1179
1183
}
1180
1184
@@ -1363,10 +1367,15 @@ mongoc_cluster_fetch_stream (mongoc_cluster_t *cluster,
1363
1367
1364
1368
scanner_node = mongoc_topology_scanner_get_node (topology -> scanner , server_id );
1365
1369
if (!scanner_node ) {
1366
- bson_set_error (error ,
1367
- MONGOC_ERROR_STREAM ,
1368
- MONGOC_ERROR_STREAM_NOT_ESTABLISHED ,
1369
- "Could not find node %u" , server_id );
1370
+ sd = mongoc_topology_description_server_by_id (& topology -> description , server_id );
1371
+ if (sd && sd -> error .code ) {
1372
+ memcpy (error , & sd -> error , sizeof * error );
1373
+ } else {
1374
+ bson_set_error (error ,
1375
+ MONGOC_ERROR_STREAM ,
1376
+ MONGOC_ERROR_STREAM_NOT_ESTABLISHED ,
1377
+ "Could not find node %u" , server_id );
1378
+ }
1370
1379
GOTO (FETCH_FAIL );
1371
1380
}
1372
1381
@@ -1396,7 +1405,8 @@ mongoc_cluster_fetch_stream (mongoc_cluster_t *cluster,
1396
1405
1397
1406
/* In single-threaded mode, we can use sd's max_wire_version */
1398
1407
if (!_mongoc_cluster_auth_node (cluster , stream , sd -> host .host ,
1399
- sd -> max_wire_version , error )) {
1408
+ sd -> max_wire_version , & sd -> error )) {
1409
+ memcpy (error , & sd -> error , sizeof * error );
1400
1410
GOTO (FETCH_FAIL );
1401
1411
}
1402
1412
scanner_node -> has_auth = true;
0 commit comments