Thanks to visit codestin.com
Credit goes to github.com

Skip to content

adafruit_wiznet5k_socket.py has hardcoded 1000 second timeouts #90

Closed
@e28eta

Description

@e28eta

Related, but separate, to #89

There are at least two hardcoded timeouts for 1000:

def __exit__(self, exc_type, exc_val, exc_tb) -> None:
if self._sock_type == SOCK_STREAM:
self.disconnect()
stamp = time.monotonic()
while self.status == wiznet5k.adafruit_wiznet5k.SNSR_SOCK_FIN_WAIT:
if time.monotonic() - stamp > 1000:
raise RuntimeError("Failed to disconnect socket")
self.close()
stamp = time.monotonic()
while self.status != wiznet5k.adafruit_wiznet5k.SNSR_SOCK_CLOSED:
if time.monotonic() - stamp > 1000:
raise RuntimeError("Failed to close socket")

I believe time.monotonic() returns the number of seconds. Waiting 1,000 seconds (over 16 minutes) in the __exit__ block is far too long.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions