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

Default timeout on ThreadedTCPSocketClient is 100 seconds #3080

Closed
zimri-leisher opened this issue Dec 17, 2024 · 4 comments
Closed

Default timeout on ThreadedTCPSocketClient is 100 seconds #3080

zimri-leisher opened this issue Dec 17, 2024 · 4 comments
Labels

Comments

@zimri-leisher
Copy link
Collaborator

F´ Version
Affected Component fprime-gds

Problem Description

The following method in ThreadedTCPSocketClient says it's default timeout is 100 ms, but it's actually 100 seconds.

 def recv(self, timeout=100):
        """Receives data from the threaded tcp server

        Receives raw data from the threaded tcp server. This data is expected to have no headers and will be passed as
        received or in chunks back to the caller.

        Args:
            timeout {int}: timeout to wait for the socket to have data before returning b"". Default: 100ms.
        """
        assert self.dest is not None, "Cannot recv data before connect call"
        ready = select.select([self.sock], [], [], timeout)
        return self.sock.recv(self.chunk_size) if ready[0] else b""

This is because the argument to select.select is in seconds, not milliseconds.

@zimri-leisher
Copy link
Collaborator Author

@matt392code
Copy link
Contributor

matt392code commented Dec 26, 2024

Changed in transport.py:
def recv(self, timeout=0.1):
"""Receives data from the threaded tcp server

nasa/fprime-gds#185

@LeStarch
Copy link
Collaborator

Fixed, thank you both!

@matt392code
Copy link
Contributor

matt392code commented Jan 16, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants