MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / _call

Method _call

pymongo/pyopenssl_context.py:118–146  ·  view source on GitHub ↗
(self, call: Callable[..., _T], *args: Any, **kwargs: Any)

Source from the content-addressed store, hash-verified

116 super().__init__(ctx, sock)
117
118 def _call(self, call: Callable[..., _T], *args: Any, **kwargs: Any) -> _T:
119 timeout = self.gettimeout()
120 if timeout:
121 start = _time.monotonic()
122 while True:
123 try:
124 return call(*args, **kwargs)
125 except BLOCKING_IO_ERRORS as exc:
126 # Do not retry if the connection is in non-blocking mode.
127 if timeout == 0:
128 raise exc
129 # Check for closed socket.
130 if self.fileno() == -1:
131 if timeout and _time.monotonic() - start > timeout:
132 raise _socket.timeout("timed out") from None
133 raise SSLError("Underlying socket has been closed") from None
134 if isinstance(exc, _SSL.WantReadError):
135 want_read = True
136 want_write = False
137 elif isinstance(exc, _SSL.WantWriteError):
138 want_read = False
139 want_write = True
140 else:
141 want_read = True
142 want_write = True
143 self.socket_checker.select(self, want_read, want_write, timeout)
144 if timeout and _time.monotonic() - start > timeout:
145 raise _socket.timeout("timed out") from None
146 continue
147
148 def do_handshake(self, *args: Any, **kwargs: Any) -> None:
149 return self._call(super().do_handshake, *args, **kwargs)

Callers 4

do_handshakeMethod · 0.95
recvMethod · 0.95
recv_intoMethod · 0.95
sendallMethod · 0.95

Calls 5

SSLErrorClass · 0.85
selectMethod · 0.80
gettimeoutMethod · 0.45
filenoMethod · 0.45
timeoutMethod · 0.45

Tested by

no test coverage detected