@@ -599,16 +599,18 @@ response data is drained and the connection is ready to send the next command.
599599 check if at least one byte can be read/received. If at least one byte can be read the timestamp must be updated and
600600 connection SHOULD be drained. If no bytes can be read, the connection MUST be closed.
6016013 . ** User-provided timeout** : If a user-provided timeout is specified for the operation, the driver MUST use the minimum
602- of (a) the remaining time before the 3 second "pending response" window elapses and (b) the user-provided timeout
603- as the effective timeout for the draining.
602+ of (a) the remaining time before the 3 second "pending response" window elapses and (b) the remaining of
603+ user-provided timeout as the effective timeout for the draining.
6046044 . ** Default timeout** : If no user-provided timeout is specified, the driver MUST use the minimum of (a) the remaining 3
605- second "pending response" window and (b) the ` socketTimeoutMS ` (if supported by the driver) as the effective
606- timeout for the draining.
607- 5 . ** Error or over-age** : If any error other than timeout occurs while draining the pending response, or if the draining
605+ second "pending response" window and (b) the ` waitQueueTimeoutMS ` (if not supported by the driver remaining of
606+ ` serverSelectionTimeoutMS ` should be used instead) as the effective timeout for the draining.
607+ 5 . ** On Timeout** : if timeout occurred while draining the pending response and the 3 seconds pending-response window was
608+ not elapsed, Driver SHOULD return the connection to the pool, so the next operation can continue draining of the
609+ pending response.
610+ 6 . ** Error or over-age** : If any error other than timeout occurs while draining the pending response, or if the draining
608611 exceeds the 3 seconds pending-response window, the driver MUST close the connection. Driver SHOULD try to make
609- another checkout attempt if timeout is not reached yet or create a new connection according to the Checking Out a
610- Connection behavior.
611- 6 . ** Clear pending state on success** : If the pending response is fully drained, the pending response state MUST be
612+ another checkout attempt accordingly to the Checking Out a Connection behavior.
613+ 7 . ** Clear pending state on success** : If the pending response is fully drained, the pending response state MUST be
612614 cleared and connection can be used to execute the next command.
613615
614616``` mermaid
@@ -653,12 +655,11 @@ sequenceDiagram
653655 end
654656```
655657
656- ```` text
657658##### Pseudocode
658659
659660This subsection outlines the pseudocode steps for acquiring a connection from the pool.
660661
661- ```python
662+ ``` text
662663connection = Null
663664tConnectionCheckOutStarted = current instant (use a monotonic clock if possible)
664665emit ConnectionCheckOutStartedEvent and equivalent log message
677678 if connection is in "pending response" state:
678679 drain the pending response
679680 if error:
680- if non-timeout error:
681- close connection
681+ if non-timeout error:
682+ close connection
682683 connection = Null
683684 else if timeout error and last read timestamp on connection > 3 seconds old
684685 close connection
@@ -739,7 +740,7 @@ do asynchronously:
739740tConnectionCheckedOut = current instant (use a monotonic clock if possible)
740741emit ConnectionCheckedOutEvent(duration = tConnectionCheckedOut - tConnectionCheckOutStarted) and equivalent log message
741742return connection
742- ````
743+ ```
743744
744745#### Checking In a Connection
745746
0 commit comments