diff --git a/adafruit_wiznet5k/adafruit_wiznet5k_socket.py b/adafruit_wiznet5k/adafruit_wiznet5k_socket.py index 7b1c373..eae8c12 100644 --- a/adafruit_wiznet5k/adafruit_wiznet5k_socket.py +++ b/adafruit_wiznet5k/adafruit_wiznet5k_socket.py @@ -118,6 +118,10 @@ def __exit__(self, exc_type, exc_val, exc_tb): if time.monotonic() - stamp > 1000: raise RuntimeError("Failed to disconnect socket") self.close() + stamp = time.monotonic() + while self.status != adafruit_wiznet5k.SNSR_SOCK_CLOSED: + if time.monotonic() - stamp > 1000: + raise RuntimeError("Failed to close socket") @property def socknum(self):