Skip to content

Instantly share code, notes, and snippets.

@martinomburajr
Last active May 14, 2019 05:08
Show Gist options
  • Select an option

  • Save martinomburajr/ef5c2ea9b58e6c432e3d111af1c4b89a to your computer and use it in GitHub Desktop.

Select an option

Save martinomburajr/ef5c2ea9b58e6c432e3d111af1c4b89a to your computer and use it in GitHub Desktop.
The Closer implementation of net.Conn
// Close closes the connection.
func (c *conn) Close() error {
if !c.ok() {
return syscall.EINVAL
}
err := c.fd.Close()
if err != nil {
err = &OpError{
Op: "close",
Net: c.fd.net,
Source: c.fd.laddr,
Addr: c.fd.raddr,
Err: err}
}
return err
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment