MCPcopy
hub / github.com/tornadoweb/tornado / try_connect

Method try_connect

tornado/tcpclient.py:115–131  ·  tornado/tcpclient.py::_Connector.try_connect
(self, addrs: Iterator[Tuple[socket.AddressFamily, Tuple]])

Source from the content-addressed store, hash-verified

113 return self.future
114
115 def try_connect(self, addrs: Iterator[Tuple[socket.AddressFamily, Tuple]]) -> None:
116 try:
117 af, addr = next(addrs)
118 except StopIteration:
119 class="cm"># We've reached the end of our queue, but the other queue
120 class="cm"># might still be working. Send a final error on the future
121 class="cm"># only when both queues are finished.
122 if self.remaining == 0 and not self.future.done():
123 self.future.set_exception(
124 self.last_error or IOError(class="st">"connection failed")
125 )
126 return
127 stream, future = self.connect(af, addr)
128 self.streams.add(stream)
129 future_add_done_callback(
130 future, functools.partial(self.on_connect_done, addrs, af, addr)
131 )
132
133 def on_connect_done(
134 self,

Callers 3

startMethod · 0.95
on_connect_doneMethod · 0.95
on_timeoutMethod · 0.95

Calls 4

future_add_done_callbackFunction · 0.90
addMethod · 0.80
doneMethod · 0.45
connectMethod · 0.45

Tested by

no test coverage detected