FAQ
I'm using io.Copy to shuttle data between two tcp connections, and There
doesn't seem to be a way of handling "use of closed network connection"
without converting the error to a net.OpError, and checking that
OpError.Err.Error() matches.

In looking at the io.Copy code, it breaks the for-loop if the Read returns
`err == EOF`, but it seems that a TCPConn will return a nil error, and 0
bytes read, similar to how a tcp socket works directly. I checked this by
copying the Copy function into my code, and adding
} else if nr == 0 {
// same as EOF
err = nil
break
}

I'm kinda new to the go codebase, and I'm not sure where the TCPConn.Read
is actually happening yet, but it seems like this should probably return
(0, EOF), instead of (0, nil). Does this look like a bug?

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/uNtOj92Xt-QJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
grouppuppet-users @
categoriespuppet
postedJan 18, '13 at 7:49p
activeJan 18, '13 at 7:49p
posts1
users1
websitepuppetlabs.com

1 user in discussion

James Bardin: 1 post

People

Translate

site design / logo © 2022 Grokbase