Mikio Hara | a877e81 | 2014-12-31 10:08:51 +0900 | [diff] [blame] | 1 | // Copyright 2009 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | // +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris windows |
| 6 | |
| 7 | package net |
| 8 | |
| 9 | import ( |
| 10 | "io" |
| 11 | "syscall" |
| 12 | ) |
| 13 | |
| 14 | // eofError returns io.EOF when fd is available for reading end of |
| 15 | // file. |
| 16 | func (fd *netFD) eofError(n int, err error) error { |
| 17 | if n == 0 && err == nil && fd.sotype != syscall.SOCK_DGRAM && fd.sotype != syscall.SOCK_RAW { |
| 18 | return io.EOF |
| 19 | } |
| 20 | return err |
| 21 | } |