Skip to content

Commit 1410525

Browse files
committed
improved comments on cluster node functions
1 parent 52d2a09 commit 1410525

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

src/mongoc/mongoc-client.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,15 @@ typedef struct _mongoc_client_t mongoc_client_t;
7575
* mongoc_stream_initiator_t:
7676
* @uri: The uri and options for the stream.
7777
* @host: The host and port (or UNIX domain socket path) to connect to.
78+
* @user_data: The pointer passed to mongoc_client_set_stream_initiator.
7879
* @error: A location for an error.
7980
*
80-
* Creates a new mongoc_stream_t for the host and port. This can be used
81-
* by language bindings to create network transports other than those
82-
* built into libmongoc. An example of such would be the streams API
83-
* provided by PHP.
81+
* Creates a new mongoc_stream_t for the host and port. Begin a
82+
* non-blocking connect and return immediately.
83+
*
84+
* This can be used by language bindings to create network transports other
85+
* than those built into libmongoc. An example of such would be the streams
86+
* API provided by PHP.
8487
*
8588
* Returns: A newly allocated mongoc_stream_t or NULL on failure.
8689
*/

src/mongoc/mongoc-topology-scanner.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ mongoc_topology_scanner_add_and_scan (mongoc_topology_scanner_t *ts,
124124

125125
node = mongoc_topology_scanner_add (ts, host, id);
126126

127+
/* begin non-blocking connection, don't wait for success */
127128
if (node && mongoc_topology_scanner_node_setup (node, &node->last_error)) {
128129
node->cmd = mongoc_async_cmd (
129130
ts->async, node->stream, ts->setup,
@@ -276,6 +277,17 @@ mongoc_topology_scanner_ismaster_handler (mongoc_async_cmd_result_t async_status
276277
node->ts->cb_data, error);
277278
}
278279

280+
/*
281+
*--------------------------------------------------------------------------
282+
*
283+
* mongoc_topology_scanner_node_connect_tcp --
284+
*
285+
* Create a socket stream for this node, begin a non-blocking
286+
* connect and return.
287+
*
288+
*--------------------------------------------------------------------------
289+
*/
290+
279291
static mongoc_stream_t *
280292
mongoc_topology_scanner_node_connect_tcp (mongoc_topology_scanner_node_t *node,
281293
bson_error_t *error)
@@ -404,6 +416,17 @@ mongoc_topology_scanner_node_connect_unix (mongoc_topology_scanner_node_t *node,
404416
#endif
405417
}
406418

419+
420+
/*
421+
*--------------------------------------------------------------------------
422+
*
423+
* mongoc_topology_scanner_node_setup --
424+
*
425+
* Create a stream and begin a non-blocking connect.
426+
*
427+
*--------------------------------------------------------------------------
428+
*/
429+
407430
bool
408431
mongoc_topology_scanner_node_setup (mongoc_topology_scanner_node_t *node, bson_error_t *error)
409432
{

0 commit comments

Comments
 (0)