rmeove duplicate timeout option from diag

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
This commit is contained in:
Jeromy 2015-07-28 08:17:42 -07:00
parent 075e68782c
commit f2b44e3338
2 changed files with 3 additions and 4 deletions

View File

@ -85,7 +85,6 @@ that consume the dot format to generate graphs of the network.
},
Options: []cmds.Option{
cmds.StringOption("timeout", "diagnostic timeout duration"),
cmds.StringOption("vis", "output vis. one of: "+strings.Join(visFmts, ", ")),
},
@ -122,7 +121,7 @@ that consume the dot format to generate graphs of the network.
timeout = t
}
info, err := n.Diagnostics.GetDiagnostic(timeout)
info, err := n.Diagnostics.GetDiagnostic(req.Context(), timeout)
if err != nil {
res.SetError(err, cmds.ErrNormal)
return

View File

@ -134,9 +134,9 @@ func newID() string {
}
// GetDiagnostic runs a diagnostics request across the entire network
func (d *Diagnostics) GetDiagnostic(timeout time.Duration) ([]*DiagInfo, error) {
func (d *Diagnostics) GetDiagnostic(ctx context.Context, timeout time.Duration) ([]*DiagInfo, error) {
log.Debug("Getting diagnostic.")
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
ctx, cancel := context.WithTimeout(ctx, timeout)
defer cancel()
diagID := newID()