The method Socket.close() has a decorator that checks if the socket is closed already. If so, the decorator throws a runtime error.
Other implementations just ignore a close() on an already closed socket which I think is the desired behavior. See also this discussion: micropython/micropython#3208
Ignoring close() is simple, since the socket keeps this state internally (self._socket_closed = True). The decorator actually checks this variable.
I can provide a PR if you agree that close() on a closed socket should just be ignored.
The method
Socket.close()has a decorator that checks if the socket is closed already. If so, the decorator throws a runtime error.Other implementations just ignore a close() on an already closed socket which I think is the desired behavior. See also this discussion: micropython/micropython#3208
Ignoring close() is simple, since the socket keeps this state internally (
self._socket_closed = True). The decorator actually checks this variable.I can provide a PR if you agree that close() on a closed socket should just be ignored.