Commit db827e6b authored by Geoff Simmons's avatar Geoff Simmons

Rename Log.AttachTmo() to .Timeout()

parent 7d7d7000
......@@ -59,22 +59,22 @@ func TestAttach(t *testing.T) {
const zerosec = time.Duration(0)
func TestAttachTmo(t *testing.T) {
func TestTimeout(t *testing.T) {
l := New()
defer l.Release()
for _, s := range []int{0, 1, -1, ^0, int(^uint(0) >> 1)} {
if e := l.AttachTmo(time.Duration(s) * time.Second); e != nil {
t.Error("AttachTmo():", e)
if e := l.Timeout(time.Duration(s) * time.Second); e != nil {
t.Error("Timeout():", e)
}
}
var n *Log
if err := n.AttachTmo(zerosec); err == nil {
t.Error("expected nil.AttachTmo() to fail")
if err := n.Timeout(zerosec); err == nil {
t.Error("expected nil.Timeout() to fail")
}
uninit := new(Log)
if err := uninit.AttachTmo(zerosec); err == nil {
t.Error("expected uninitialized.AttachTmo() to fail")
if err := uninit.Timeout(zerosec); err == nil {
t.Error("expected uninitialized.Timeout() to fail")
}
}
......@@ -87,8 +87,8 @@ func TestAttachInstance(t *testing.T) {
f := New()
defer f.Release()
if err := f.AttachTmo(zerosec); err != nil {
t.Error("AttachTmo(0s):", err)
if err := f.Timeout(zerosec); err != nil {
t.Error("Timeout(0s):", err)
}
if err := f.Attach("instanceDoesNotExist"); err == nil {
t.Error("expected Attach() to fail for a " +
......
......@@ -146,12 +146,12 @@ func (log *Log) initVSM() error {
return nil
}
// AttachTmo sets the timeout for attaching to a Varnish instance.
// The timeout is truncated to seconds. If the truncated timeout >=
// 0s, then wait that many seconds to attach. If the tmo < 0s, wait
// Timeout sets the timeout for attaching to a Varnish instance. The
// timeout is truncated to seconds. If the truncated timeout >= 0s,
// then wait that many seconds to attach. If the tmo < 0s, wait
// indefinitely. By default, the Varnish default timeout holds (5s in
// recent Varnish versions).
func (log *Log) AttachTmo(tmo time.Duration) error {
func (log *Log) Timeout(tmo time.Duration) error {
if err := log.initVSM(); err != nil {
return err
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment