Return (Hello, round_trip_time). Can raise ConnectionFailure or OperationFailure.
(self, conn: Connection)
| 350 | return sd |
| 351 | |
| 352 | def _check_with_socket(self, conn: Connection) -> tuple[Hello, float]: # type: ignore[type-arg] |
| 353 | """Return (Hello, round_trip_time). |
| 354 | |
| 355 | Can raise ConnectionFailure or OperationFailure. |
| 356 | """ |
| 357 | start = time.monotonic() |
| 358 | if conn.more_to_come: |
| 359 | # Read the next streaming hello (MongoDB 4.4+). |
| 360 | response = Hello(conn._next_reply(), awaitable=True) |
| 361 | elif ( |
| 362 | self._stream and conn.performed_handshake and self._server_description.topology_version |
| 363 | ): |
| 364 | # Initiate streaming hello (MongoDB 4.4+). |
| 365 | response = conn._hello( |
| 366 | self._server_description.topology_version, |
| 367 | self._settings.heartbeat_frequency, |
| 368 | ) |
| 369 | else: |
| 370 | # New connection handshake or polling hello (MongoDB <4.4). |
| 371 | response = conn._hello(None, None) |
| 372 | duration = _monotonic_duration(start) |
| 373 | return response, duration |
| 374 | |
| 375 | |
| 376 | class SrvMonitor(MonitorBase): |
no test coverage detected