Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnishapi
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
varnishapi
Commits
86aa2d19
Commit
86aa2d19
authored
Aug 29, 2018
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename vsm.AttachTmo() to .Timeout().
parent
19b11ee5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
14 deletions
+14
-14
admin.go
pkg/admin/admin.go
+1
-1
log.go
pkg/log/log.go
+1
-1
stats.go
pkg/stats/stats.go
+1
-1
e2e_test.go
pkg/vsm/e2e_test.go
+9
-9
vsm.go
pkg/vsm/vsm.go
+2
-2
No files found.
pkg/admin/admin.go
View file @
86aa2d19
...
@@ -329,7 +329,7 @@ func Attach(name string, timeout time.Duration) (*Admin, error) {
...
@@ -329,7 +329,7 @@ func Attach(name string, timeout time.Duration) (*Admin, error) {
return
nil
,
errors
.
New
(
"Cannot initialize for attachment"
)
return
nil
,
errors
.
New
(
"Cannot initialize for attachment"
)
}
}
defer
vsm
.
Destroy
()
defer
vsm
.
Destroy
()
if
err
:=
vsm
.
AttachTmo
(
timeout
);
err
!=
nil
{
if
err
:=
vsm
.
Timeout
(
timeout
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
if
err
:=
vsm
.
Attach
(
name
);
err
!=
nil
{
if
err
:=
vsm
.
Attach
(
name
);
err
!=
nil
{
...
...
pkg/log/log.go
View file @
86aa2d19
...
@@ -155,7 +155,7 @@ func (log *Log) Timeout(tmo time.Duration) error {
...
@@ -155,7 +155,7 @@ func (log *Log) Timeout(tmo time.Duration) error {
if
err
:=
log
.
initVSM
();
err
!=
nil
{
if
err
:=
log
.
initVSM
();
err
!=
nil
{
return
err
return
err
}
}
return
log
.
vsm
.
AttachTmo
(
tmo
)
return
log
.
vsm
.
Timeout
(
tmo
)
}
}
// Attach to an instance of Varnish -- varnishd with a running worker
// Attach to an instance of Varnish -- varnishd with a running worker
...
...
pkg/stats/stats.go
View file @
86aa2d19
...
@@ -272,7 +272,7 @@ func (stats *Stats) Timeout(tmo time.Duration) error {
...
@@ -272,7 +272,7 @@ func (stats *Stats) Timeout(tmo time.Duration) error {
if
err
:=
stats
.
initVSM
();
err
!=
nil
{
if
err
:=
stats
.
initVSM
();
err
!=
nil
{
return
err
return
err
}
}
return
stats
.
vsm
.
AttachTmo
(
tmo
)
return
stats
.
vsm
.
Timeout
(
tmo
)
}
}
func
(
stats
*
Stats
)
clude
(
nmGlob
string
,
exclude
bool
)
error
{
func
(
stats
*
Stats
)
clude
(
nmGlob
string
,
exclude
bool
)
error
{
...
...
pkg/vsm/e2e_test.go
View file @
86aa2d19
...
@@ -100,22 +100,22 @@ func TestAttach(t *testing.T) {
...
@@ -100,22 +100,22 @@ func TestAttach(t *testing.T) {
const
zerosec
=
time
.
Duration
(
0
)
const
zerosec
=
time
.
Duration
(
0
)
func
Test
AttachTmo
(
t
*
testing
.
T
)
{
func
Test
Timeout
(
t
*
testing
.
T
)
{
v
:=
New
()
v
:=
New
()
defer
v
.
Destroy
()
defer
v
.
Destroy
()
for
_
,
s
:=
range
[]
int
{
0
,
1
,
-
1
,
^
0
,
int
(
^
uint
(
0
)
>>
1
)}
{
for
_
,
s
:=
range
[]
int
{
0
,
1
,
-
1
,
^
0
,
int
(
^
uint
(
0
)
>>
1
)}
{
if
e
:=
v
.
AttachTmo
(
time
.
Duration
(
s
)
*
time
.
Second
);
e
!=
nil
{
if
e
:=
v
.
Timeout
(
time
.
Duration
(
s
)
*
time
.
Second
);
e
!=
nil
{
t
.
Error
(
"
AttachTmo
():"
,
e
)
t
.
Error
(
"
Timeout
():"
,
e
)
}
}
}
}
var
n
*
VSM
var
n
*
VSM
if
err
:=
n
.
AttachTmo
(
zerosec
);
err
==
nil
{
if
err
:=
n
.
Timeout
(
zerosec
);
err
==
nil
{
t
.
Error
(
"expected nil.
AttachTmo
() to fail"
)
t
.
Error
(
"expected nil.
Timeout
() to fail"
)
}
}
uninit
:=
new
(
VSM
)
uninit
:=
new
(
VSM
)
if
err
:=
uninit
.
AttachTmo
(
zerosec
);
err
==
nil
{
if
err
:=
uninit
.
Timeout
(
zerosec
);
err
==
nil
{
t
.
Error
(
"expected uninitialized.
AttachTmo
() to fail"
)
t
.
Error
(
"expected uninitialized.
Timeout
() to fail"
)
}
}
}
}
...
@@ -128,8 +128,8 @@ func TestAttachInstance(t *testing.T) {
...
@@ -128,8 +128,8 @@ func TestAttachInstance(t *testing.T) {
f
:=
New
()
f
:=
New
()
defer
f
.
Destroy
()
defer
f
.
Destroy
()
if
err
:=
f
.
AttachTmo
(
zerosec
);
err
!=
nil
{
if
err
:=
f
.
Timeout
(
zerosec
);
err
!=
nil
{
t
.
Error
(
"
AttachTmo
(0s):"
,
err
)
t
.
Error
(
"
Timeout
(0s):"
,
err
)
}
}
if
err
:=
f
.
Attach
(
"instanceDoesNotExist"
);
err
==
nil
{
if
err
:=
f
.
Attach
(
"instanceDoesNotExist"
);
err
==
nil
{
t
.
Error
(
"expected Attach() to fail for a "
+
t
.
Error
(
"expected Attach() to fail for a "
+
...
...
pkg/vsm/vsm.go
View file @
86aa2d19
...
@@ -118,12 +118,12 @@ func (v *VSM) Error() string {
...
@@ -118,12 +118,12 @@ func (v *VSM) Error() string {
return
C
.
GoString
(
C
.
VSM_Error
(
v
.
VSM
))
return
C
.
GoString
(
C
.
VSM_Error
(
v
.
VSM
))
}
}
//
AttachTmo
sets the timeout for attaching to a Varnish instance. If
//
Timeout
sets the timeout for attaching to a Varnish instance. If
// the Duration, truncated to seconds, is >= 0s, then wait that many
// the Duration, truncated to seconds, is >= 0s, then wait that many
// seconds to attach. If the Duration < 0s, wait indefinitely. By
// seconds to attach. If the Duration < 0s, wait indefinitely. By
// default, the Varnish default timeout holds (5s in recent Varnish
// default, the Varnish default timeout holds (5s in recent Varnish
// versions).
// versions).
func
(
v
*
VSM
)
AttachTmo
(
tmo
time
.
Duration
)
error
{
func
(
v
*
VSM
)
Timeout
(
tmo
time
.
Duration
)
error
{
if
err
:=
v
.
checkNil
();
err
!=
nil
{
if
err
:=
v
.
checkNil
();
err
!=
nil
{
return
err
return
err
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment