2015-01-29 2:47 GMT+01:00 Guido van Rossum <[email protected]>:
> Doesn't the exception bubble up to the caller of create_connection()?

Yes, it does.

>  So what's the problem?

The problem is in server which accepts incoming connections:
BaseSelectorEventLoop._accept_conncetion(). Extract of the code:
---
    conn, addr = sock.accept()
    (...)
    protocol = protocol_factory()
    if sslcontext:
        self._make_ssl_transport(
            conn, protocol, sslcontext,
            server_side=True, extra={'peername': addr}, server=server)
    else:
        self._make_socket_transport(
            conn, protocol , extra={'peername': addr},
            server=server)
    # It's now up to the protocol to handle the connection.
---

If the transport fails before calling connection_made() (ex: SSL
handshake failure): the transport and the protocol are destroyed, no
message is logged, the server is not aware of the connection failure.

I would like to notify the server through the protocol (call
connection_failed) that an incoming connection failed. Random use
case: blacklist temporary the client IP.

Victor

Reply via email to