https_server.py
def cleanup_connection(sock, poller, message_queues=None, sock_to_ja3=None):
    """Cleans up the connection for the given TCP socket.

    Arguments:
        sock (:obj: `socket`) current connected socket to close the connection
            with
        poller (:obj: `select.poll`) poller for concurrent IO operations
        message_queues (:obj: `queue.queue`) Optionally provided queue for the
            socket's outgoing messages
        sock_to_ja3 (:obj: `dict`) Optional dictionary that maps socket objects
            to its ja3 fingerprint
    """

    try:
        _LOGGER.info("Closing connection to %s", sock.getpeername())
    except OSError as err:
        _LOGGER.error(err)
        _LOGGER.info("Closing connection to %s", sock)

        if sock.fileno() == -1:
            _LOGGER.warning("Socket prematurely closed on client end: fd == -1")
            return

    poller.unregister(sock)
    # gracefully shutdown to eliminate RST packets
    sock.close()

    if message_queues is not None:
        del message_queues[sock]
    if sock_to_ja3 is not None:
        del sock_to_ja3[sock]
Cleans up the connection for the given TCP socket.

    Arguments:
        sock (:obj: `socket`) current connected socket to close the connection
            with
        poller (:obj: `select.poll`) poller for concurrent IO operations
        message_queues (:obj: `queue.queue`) Optionally provided queue for the
            socket's outgoing messages
        sock_to_ja3 (:obj: `dict`) Optional dictionary that maps socket objects
            to its ja3 fingerprint
    
Cleans up the connection for the given TCP socket.
Cleans up the connection for the given TCP socket .
def cleanup_connection(sock, poller, message_queues=None, sock_to_ja3=None):
    try:
        _LOGGER.info("Closing connection to %s", sock.getpeername())
    except OSError as err:
        _LOGGER.error(err)
        _LOGGER.info("Closing connection to %s", sock)
        if sock.fileno() == -1:
            _LOGGER.warning("Socket prematurely closed on client end: fd == -1")
            return
    poller.unregister(sock)
    sock.close()
    if message_queues is not None:
        del message_queues[sock]
    if sock_to_ja3 is not None:
        del sock_to_ja3[sock]
def cleanup_connection ( sock , poller , message_queues = None , sock_to_ja3 = None ) : try : _LOGGER . info ( "Closing connection to %s" , sock . getpeername ( ) ) except OSError as err : _LOGGER . error ( err ) _LOGGER . info ( "Closing connection to %s" , sock ) if sock . fileno ( ) == - 1 : _LOGGER . warning ( "Socket prematurely closed on client end: fd == -1" ) return poller . unregister ( sock ) sock . close ( ) if message_queues is not None : del message_queues [ sock ] if sock_to_ja3 is not None : del sock_to_ja3 [ sock ]
Cleans up the connection for the given TCP socket.
Cleans up the connection for the given TCP socket .
"""Cleans up the connection for the given TCP socket.

    Arguments:
        sock (:obj: `socket`) current connected socket to close the connection
            with
        poller (:obj: `select.poll`) poller for concurrent IO operations
        message_queues (:obj: `queue.queue`) Optionally provided queue for the
            socket's outgoing messages
        sock_to_ja3 (:obj: `dict`) Optional dictionary that maps socket objects
            to its ja3 fingerprint
    """ # gracefully shutdown to eliminate RST packets
sock
poller
message_queues
sock_to_ja3
sock (
`socket`) current connected socket to close the connection
with
` socket ` ) current connected socket to close the connection with
poller (
`select.poll`) poller for concurrent IO operations
` select . poll ` ) poller for concurrent IO operations
message_queues (
`queue.queue`) Optionally provided queue for the
socket's outgoing messages
` queue . queue ` ) Optionally provided queue for the socket ' s outgoing messages
sock_to_ja3 (
`dict`) Optional dictionary that maps socket objects
to its ja3 fingerprint
` dict ` ) Optional dictionary that maps socket objects to its ja3 fingerprint