Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
898b9696
Commit
898b9696
authored
Jan 17, 2015
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
diag/net: add timeout param to cmd
parent
c64338a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
core/commands/diag.go
core/commands/diag.go
+17
-1
No files found.
core/commands/diag.go
View file @
898b9696
...
...
@@ -36,6 +36,8 @@ type DiagnosticOutput struct {
Peers
[]
DiagnosticPeer
}
var
DefaultDiagnosticTimeout
=
time
.
Second
*
20
var
DiagCmd
=
&
cmds
.
Command
{
Helptext
:
cmds
.
HelpText
{
Tagline
:
"Generates diagnostic reports"
,
...
...
@@ -57,6 +59,7 @@ connected peers and latencies between them.
},
Options
:
[]
cmds
.
Option
{
cmds
.
StringOption
(
"timeout"
,
"diagnostic timeout duration"
),
cmds
.
StringOption
(
"vis"
,
"output vis. one of: "
+
strings
.
Join
(
visFmts
,
", "
)),
},
...
...
@@ -75,7 +78,20 @@ connected peers and latencies between them.
return
nil
,
err
}
info
,
err
:=
n
.
Diagnostics
.
GetDiagnostic
(
time
.
Second
*
20
)
timeoutS
,
_
,
err
:=
req
.
Option
(
"timeout"
)
.
String
()
if
err
!=
nil
{
return
nil
,
err
}
timeout
:=
DefaultDiagnosticTimeout
if
timeoutS
!=
""
{
t
,
err
:=
time
.
ParseDuration
(
timeoutS
)
if
err
!=
nil
{
return
nil
,
cmds
.
ClientError
(
"error parsing timeout"
)
}
timeout
=
t
}
info
,
err
:=
n
.
Diagnostics
.
GetDiagnostic
(
timeout
)
if
err
!=
nil
{
return
nil
,
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