Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(46)

Delta Between Two Patch Sets: src/pkg/net/fd_windows.go

Issue 5136052: code review 5136052: net: add shutdown: TCPConn.CloseWrite and CloseRead (Closed)
Left Patch Set: Created 13 years, 6 months ago
Right Patch Set: diff -r 6c5c19791fae https://go.googlecode.com/hg/ Created 13 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/net/fd.go ('k') | src/pkg/net/net_test.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2010 The Go Authors. All rights reserved. 1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package net 5 package net
6 6
7 import ( 7 import (
8 "os" 8 "os"
9 "runtime" 9 "runtime"
10 "sync" 10 "sync"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 return os.EINVAL 305 return os.EINVAL
306 } 306 }
307 307
308 fd.incref() 308 fd.incref()
309 syscall.Shutdown(fd.sysfd, syscall.SHUT_RDWR) 309 syscall.Shutdown(fd.sysfd, syscall.SHUT_RDWR)
310 fd.closing = true 310 fd.closing = true
311 fd.decref() 311 fd.decref()
312 return nil 312 return nil
313 } 313 }
314 314
315 func (fd *netFD) CloseRead() os.Error {
316 if fd == nil || fd.sysfd == syscall.InvalidHandle {
317 return os.EINVAL
318 }
319 syscall.Shutdown(fd.sysfd, syscall.SHUT_RD)
320 return nil
321 }
322
323 func (fd *netFD) CloseWrite() os.Error {
324 if fd == nil || fd.sysfd == syscall.InvalidHandle {
325 return os.EINVAL
326 }
327 syscall.Shutdown(fd.sysfd, syscall.SHUT_WR)
328 return nil
329 }
330
315 // Read from network. 331 // Read from network.
316 332
317 type readOp struct { 333 type readOp struct {
318 bufOp 334 bufOp
319 } 335 }
320 336
321 func (o *readOp) Submit() (errno int) { 337 func (o *readOp) Submit() (errno int) {
322 var d, f uint32 338 var d, f uint32
323 return syscall.WSARecv(syscall.Handle(o.fd.sysfd), &o.buf, 1, &d, &f, &o .o, nil) 339 return syscall.WSARecv(syscall.Handle(o.fd.sysfd), &o.buf, 1, &d, &f, &o .o, nil)
324 } 340 }
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 return nil, os.NewSyscallError("dup", syscall.EWINDOWS) 553 return nil, os.NewSyscallError("dup", syscall.EWINDOWS)
538 } 554 }
539 555
540 func (fd *netFD) ReadMsg(p []byte, oob []byte) (n, oobn, flags int, sa syscall.S ockaddr, err os.Error) { 556 func (fd *netFD) ReadMsg(p []byte, oob []byte) (n, oobn, flags int, sa syscall.S ockaddr, err os.Error) {
541 return 0, 0, 0, nil, os.EAFNOSUPPORT 557 return 0, 0, 0, nil, os.EAFNOSUPPORT
542 } 558 }
543 559
544 func (fd *netFD) WriteMsg(p []byte, oob []byte, sa syscall.Sockaddr) (n int, oob n int, err os.Error) { 560 func (fd *netFD) WriteMsg(p []byte, oob []byte, sa syscall.Sockaddr) (n int, oob n int, err os.Error) {
545 return 0, 0, os.EAFNOSUPPORT 561 return 0, 0, os.EAFNOSUPPORT
546 } 562 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b