LEFT | RIGHT |
(no file at all) | |
| 1 // Copyright 2012 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 freebsd netbsd openbsd windows |
| 6 |
| 7 // Socket options |
| 8 |
| 9 package net |
| 10 |
| 11 import ( |
| 12 "time" |
| 13 ) |
| 14 |
| 15 func setReadDeadline(fd *netFD, t time.Time) error { |
| 16 if t.IsZero() { |
| 17 fd.rdeadline = 0 |
| 18 } else { |
| 19 fd.rdeadline = t.UnixNano() |
| 20 } |
| 21 return nil |
| 22 } |
| 23 |
| 24 func setWriteDeadline(fd *netFD, t time.Time) error { |
| 25 if t.IsZero() { |
| 26 fd.wdeadline = 0 |
| 27 } else { |
| 28 fd.wdeadline = t.UnixNano() |
| 29 } |
| 30 return nil |
| 31 } |
| 32 |
| 33 func setDeadline(fd *netFD, t time.Time) error { |
| 34 if err := setReadDeadline(fd, t); err != nil { |
| 35 return err |
| 36 } |
| 37 return setWriteDeadline(fd, t) |
| 38 } |
LEFT | RIGHT |