Summary

socket egg: socket-close should track closed status

Metadata

Description

We should probably track socket closed status, possibly by setting the fileno to #f when socket-close is called. This should prevent accidental reuse of the socket FD when it is reopened by someone else.

It's not clear whether socket-close should stop throwing an error on double-close, or if this should be done instead in socket-close*. This would be appropriate behavior to use in a finalizer. But socket-close* is targeted for (immediate) use after network error.

Also note there are a bunch of direct calls to _close_socket which might have to be corrected to track the closed state.