James Bardin
2013-Jan-18 19:18 UTC
[Puppet Users] handling "use of closed network connection" from TCPConn.Read (Read doesn''t return EOF)
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.