Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: don't return io.EOF on reading data from datagram, raw sockets o…
…n windows Preventing returning io.EOF on non-connection oriented sockets is already applied to Unix variants. This CL applies it to Windows. Update #4856. Change-Id: I82071d40f617e2962d0540b9d1d6a10ea4cdb2ec Reviewed-on: https://go-review.googlesource.com/2203 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
- Loading branch information
Showing
4 changed files
with
32 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright 2009 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris windows | ||
|
||
package net | ||
|
||
import ( | ||
"io" | ||
"syscall" | ||
) | ||
|
||
// eofError returns io.EOF when fd is available for reading end of | ||
// file. | ||
func (fd *netFD) eofError(n int, err error) error { | ||
if n == 0 && err == nil && fd.sotype != syscall.SOCK_DGRAM && fd.sotype != syscall.SOCK_RAW { | ||
return io.EOF | ||
} | ||
return err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters