James Bardin
2013-01-19 00:51:08 UTC
Please ignore my previous post (pending moderation), Read() on a TCPConn
does not return (0, nil).
Since I figure I have to deal with the "use of closed network connection"
in order to close a connection that's in a Read() call (unless I poll for a
closing channel in between setting SetReadDeadline).This is basically the
function I have to filter out this error:
func checkNetOpError(err error) error {
if err != nil {
netOpError, ok := err.(*net.OpError)
if ok && netOpError.Err.Error() == "use of closed network connection" {
return nil
}
}
return err
}
This seems awkward though; is this the best way to handle this?
--
does not return (0, nil).
Since I figure I have to deal with the "use of closed network connection"
in order to close a connection that's in a Read() call (unless I poll for a
closing channel in between setting SetReadDeadline).This is basically the
function I have to filter out this error:
func checkNetOpError(err error) error {
if err != nil {
netOpError, ok := err.(*net.OpError)
if ok && netOpError.Err.Error() == "use of closed network connection" {
return nil
}
}
return err
}
This seems awkward though; is this the best way to handle this?
--