net: Added function SetTimeout() to interface Listener.

Fixes #2148.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4905042
This commit is contained in:
Aleksandar Dezelin 2011-08-16 18:36:51 -04:00 committed by Russ Cox
parent 182cf988e9
commit d72c96df2a
3 changed files with 22 additions and 1 deletions

View file

@ -423,6 +423,14 @@ func (l *UnixListener) Close() os.Error {
// Addr returns the listener's network address.
func (l *UnixListener) Addr() Addr { return l.fd.laddr }
// SetTimeout sets the deadline associated wuth the listener
func (l *UnixListener) SetTimeout(nsec int64) (err os.Error) {
if l == nil || l.fd == nil {
return os.EINVAL
}
return setTimeout(l.fd, nsec)
}
// File returns a copy of the underlying os.File, set to blocking mode.
// It is the caller's responsibility to close f when finished.
// Closing c does not affect f, and closing f does not affect c.