Skip to content

Commit 83817ce

Browse files
Jérôme Lebelhanumantmk
authored andcommitted
making public DEFAULT_SOCKET_TIMEOUT_MSEC and changing the name to match MONGOC_DEFAULT_CONNECTTIMEOUTMS
Closes #95
1 parent d3c4a79 commit 83817ce

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/mongoc/mongoc-client.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ BSON_BEGIN_DECLS
4949
#endif
5050

5151

52+
#ifndef MONGOC_DEFAULT_SOCKETTIMEOUTMS
53+
/*
54+
* NOTE: The default socket timeout for connections is 5 minutes. This
55+
* means that if your MongoDB server dies or becomes unavailable
56+
* it will take 5 minutes to detect this.
57+
*
58+
* You can change this by providing sockettimeoutms= in your
59+
* connection URI.
60+
*/
61+
#define MONGOC_DEFAULT_SOCKETTIMEOUTMS (1000L * 60L * 5L)
62+
#endif
63+
64+
5265
/**
5366
* mongoc_client_t:
5467
*

src/mongoc/mongoc-cluster.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,6 @@
6666
#define CHECK_CLOSED_DURATION_MSEC 1000
6767

6868

69-
#ifndef DEFAULT_SOCKET_TIMEOUT_MSEC
70-
/*
71-
* NOTE: The default socket timeout for connections is 5 minutes. This
72-
* means that if your MongoDB server dies or becomes unavailable
73-
* it will take 5 minutes to detect this.
74-
*
75-
* You can change this by providing sockettimeoutms= in your
76-
* connection URI.
77-
*/
78-
#define DEFAULT_SOCKET_TIMEOUT_MSEC (1000L * 60L * 5L)
79-
#endif
80-
81-
8269
#ifndef UNHEALTHY_RECONNECT_TIMEOUT_USEC
8370
/*
8471
* Try reconnect every 20 seconds if we are unhealthy.
@@ -484,7 +471,7 @@ _mongoc_cluster_init (mongoc_cluster_t *cluster,
484471
{
485472
const mongoc_host_list_t *hosts;
486473
const mongoc_host_list_t *host_iter;
487-
uint32_t sockettimeoutms = DEFAULT_SOCKET_TIMEOUT_MSEC;
474+
uint32_t sockettimeoutms = MONGOC_DEFAULT_SOCKETTIMEOUTMS;
488475
uint32_t i;
489476
const bson_t *b;
490477
bson_iter_t iter;
@@ -513,7 +500,7 @@ _mongoc_cluster_init (mongoc_cluster_t *cluster,
513500

514501
if (bson_iter_init_find_case(&iter, b, "sockettimeoutms")) {
515502
if (!(sockettimeoutms = bson_iter_int32 (&iter))) {
516-
sockettimeoutms = DEFAULT_SOCKET_TIMEOUT_MSEC;
503+
sockettimeoutms = MONGOC_DEFAULT_SOCKETTIMEOUTMS;
517504
}
518505
}
519506

0 commit comments

Comments
 (0)