Prevent double-close panic in conn.Close

inWorker calls Conn.Close() following a read error.  The read error may
be caused by an external caller calling Conn.Close() in an active close
of the established connection.  Only one of the callers shall be
permitted to perform the actual closing.

We're already maintaining a synchronized closed state in Conn.closed,
simply short-circuit Conn.Close() when Conn.closed == true.
1 file changed