Skip to content

socket timeout set too soon #20

@alchemyconsulting

Description

@alchemyconsulting

Hi, in EPPClient.connect(), the socket_connect_timeout value is used to set the initial timeout, connection to EPP is made, then socket_timeout value is used to reset the socket timeout. However, SSL negotation and socket wrap and greeting is then made with the socket_timeout value as the timeout.

self.sock = socket.socket(address_family or socket.AF_INET, socket.SOCK_STREAM)
        self.sock.settimeout(self.socket_connect_timeout)  # connect timeout
        self.sock.connect((host, port or self.port))
        local_sock_addr = self.sock.getsockname()
        local_addr, local_port = local_sock_addr[:2]
        self.log.debug('connected local=%s:%s remote=%s:%s',
                       local_addr, local_port, self.sock.getpeername()[0], port)
        self.sock.settimeout(self.socket_timeout)  # regular timeout
        if self.ssl_enable:

However, if the socket_connect_timeout is set to a larger value (say 5 seconds) to ensure connection, and then a low value (say 0.1) is set for socket_timeout, in order to cut off any EPP commands that are taking too long, the initial ssl part of the connect() method can/will likely fail due to the lower timeout.

It might be better to set the socket_timeout value (self.sock.settimeout(self.socket_timeout)) after all the SSL work is done, just before connect() completes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions