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

Method _handle_connect

tornado/iostream.py:1270–1296  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1268 return future
1269
1270 def _handle_connect(self) -> None:
1271 try:
1272 err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
1273 except OSError as e:
1274 # Hurd doesn't allow SO_ERROR for loopback sockets because all
1275 # errors for such sockets are reported synchronously.
1276 if errno_from_exception(e) == errno.ENOPROTOOPT:
1277 err = 0
1278 if err != 0:
1279 self.error = socket.error(err, os.strerror(err))
1280 # IOLoop implementations may vary: some of them return
1281 # an error state before the socket becomes writable, so
1282 # in that case a connection failure would be handled by the
1283 # error path in _handle_events instead of here.
1284 if self._connect_future is None:
1285 gen_log.warning(
1286 "Connect error on fd %s: %s",
1287 self.socket.fileno(),
1288 errno.errorcode[err],
1289 )
1290 self.close()
1291 return
1292 if self._connect_future is not None:
1293 future = self._connect_future
1294 self._connect_future = None
1295 future_set_result_unless_cancelled(future, self)
1296 self._connecting = False
1297
1298 def set_nodelay(self, value: bool) -> None:
1299 if self.socket is not None and self.socket.family in (

Callers 1

_handle_connectMethod · 0.45

Calls 4

errno_from_exceptionFunction · 0.90
filenoMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected