Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transport reseting socket timeout to 0.1 all the time. #476

Open
mattmaniflaf opened this issue Jan 9, 2015 · 0 comments
Open

Transport reseting socket timeout to 0.1 all the time. #476

mattmaniflaf opened this issue Jan 9, 2015 · 0 comments

Comments

@mattmaniflaf
Copy link

When created a new Client connection and the socket to use is not specified, but timeout value is specified. Paramiko correctly creates the socket and sets the socket timeout value, however when instantiating the Client's transport the sockets timeout gets reset to 0.1 all the time.

Transport.init.py really should attempt to use the existing timeout value for the socket.

Current code:

        # Python < 2.3 doesn't have the settimeout method - RogerB
        try:
            # we set the timeout so we can check self.active periodically to
            # see if we should bail.  socket.timeout exception is never
            # propagated.
            self.sock.settimeout(0.1)
        except AttributeError:
            pass

Probably should read:

        # Python < 2.3 doesn't have the settimeout method - RogerB
        try:
            if sock.gettimeout() < 0:
                # we set the timeout so we can check self.active periodically to
                # see if we should bail.  socket.timeout exception is never
                # propagated.
                self.sock.settimeout(0.1)
        except AttributeError:
            pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants