Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
791b2a49
Commit
791b2a49
authored
Oct 12, 2011
by
Albert Strasheim
Committed by
Russ Cox
Oct 12, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net: Return error from CloseRead and CloseWrite.
R=bradfitz, rsc, iant CC=golang-dev
https://golang.org/cl/5167043
parent
51057bda
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
14 deletions
+20
-14
fd.go
src/pkg/net/fd.go
+10
-7
fd_windows.go
src/pkg/net/fd_windows.go
+10
-7
No files found.
src/pkg/net/fd.go
View file @
791b2a49
...
...
@@ -358,20 +358,23 @@ func (fd *netFD) Close() os.Error {
return
nil
}
func
(
fd
*
netFD
)
CloseRead
(
)
os
.
Error
{
func
(
fd
*
netFD
)
shutdown
(
how
int
)
os
.
Error
{
if
fd
==
nil
||
fd
.
sysfile
==
nil
{
return
os
.
EINVAL
}
syscall
.
Shutdown
(
fd
.
sysfd
,
syscall
.
SHUT_RD
)
errno
:=
syscall
.
Shutdown
(
fd
.
sysfd
,
how
)
if
errno
!=
0
{
return
&
OpError
{
"shutdown"
,
fd
.
net
,
fd
.
laddr
,
os
.
Errno
(
errno
)}
}
return
nil
}
func
(
fd
*
netFD
)
CloseRead
()
os
.
Error
{
return
fd
.
shutdown
(
syscall
.
SHUT_RD
)
}
func
(
fd
*
netFD
)
CloseWrite
()
os
.
Error
{
if
fd
==
nil
||
fd
.
sysfile
==
nil
{
return
os
.
EINVAL
}
syscall
.
Shutdown
(
fd
.
sysfd
,
syscall
.
SHUT_WR
)
return
nil
return
fd
.
shutdown
(
syscall
.
SHUT_WR
)
}
func
(
fd
*
netFD
)
Read
(
p
[]
byte
)
(
n
int
,
err
os
.
Error
)
{
...
...
src/pkg/net/fd_windows.go
View file @
791b2a49
...
...
@@ -312,20 +312,23 @@ func (fd *netFD) Close() os.Error {
return
nil
}
func
(
fd
*
netFD
)
CloseRead
(
)
os
.
Error
{
func
(
fd
*
netFD
)
shutdown
(
how
int
)
os
.
Error
{
if
fd
==
nil
||
fd
.
sysfd
==
syscall
.
InvalidHandle
{
return
os
.
EINVAL
}
syscall
.
Shutdown
(
fd
.
sysfd
,
syscall
.
SHUT_RD
)
errno
:=
syscall
.
Shutdown
(
fd
.
sysfd
,
how
)
if
errno
!=
0
{
return
&
OpError
{
"shutdown"
,
fd
.
net
,
fd
.
laddr
,
os
.
Errno
(
errno
)}
}
return
nil
}
func
(
fd
*
netFD
)
CloseRead
()
os
.
Error
{
return
fd
.
shutdown
(
syscall
.
SHUT_RD
)
}
func
(
fd
*
netFD
)
CloseWrite
()
os
.
Error
{
if
fd
==
nil
||
fd
.
sysfd
==
syscall
.
InvalidHandle
{
return
os
.
EINVAL
}
syscall
.
Shutdown
(
fd
.
sysfd
,
syscall
.
SHUT_WR
)
return
nil
return
fd
.
shutdown
(
syscall
.
SHUT_WR
)
}
// Read from network.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment