LEFT | RIGHT |
(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 Loading... |
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 Loading... |
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 } |
LEFT | RIGHT |