Skip to content

Commit f7cb8c4

Browse files
committed
CDRIVER-480: Check for closed sockets before sending things over the wire
1 parent 59ef964 commit f7cb8c4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/mongoc/mongoc-cluster.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,6 +2034,13 @@ _mongoc_cluster_check_interval (mongoc_cluster_t *cluster,
20342034

20352035
now = bson_get_monotonic_time ();
20362036

2037+
if (scanner_node->last_used + (1000 * CHECK_CLOSED_DURATION_MSEC) < now) {
2038+
if (mongoc_stream_check_closed (stream)) {
2039+
mongoc_cluster_disconnect_node (cluster, server_id);
2040+
return false;
2041+
}
2042+
}
2043+
20372044
if (scanner_node->last_used + (1000 * cluster->socketcheckintervalms) <
20382045
now) {
20392046
bson_init (&command);

0 commit comments

Comments
 (0)