diff options
author | Andrea Barberio <insomniac@slackware.it> | 2019-04-29 23:59:45 +0100 |
---|---|---|
committer | insomniac <insomniacslk@users.noreply.github.com> | 2019-04-30 10:20:14 +0100 |
commit | 807624aab3131a49f1200102bff1259316c05e56 (patch) | |
tree | 848598b10d47ddd6cf9732f9599029d69f6f4161 /netboot | |
parent | 03e9ac918544b248cd2d660195934d7c943cb4d7 (diff) |
[netboot] Return error when there is one
The current implementation has a bug, so that it always returns `nil`,
even when an error happened. This PR fixes it.
Signed-off-by: Andrea Barberio <insomniac@slackware.it>
Diffstat (limited to 'netboot')
-rw-r--r-- | netboot/netboot.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/netboot/netboot.go b/netboot/netboot.go index 0b854c6..bfa7ce5 100644 --- a/netboot/netboot.go +++ b/netboot/netboot.go @@ -33,11 +33,11 @@ func RequestNetbootv6(ifname string, timeout time.Duration, retries int, modifie conversation, err = client.Exchange(ifname, modifiers...) if err != nil { log.Printf("Client.Exchange failed: %v", err) - log.Printf("sleeping %v before retrying", delay) if i >= retries { // don't wait at the end of the last attempt - break + return nil, fmt.Errorf("netboot failed after %d attempts: %v", retries+1, err) } + log.Printf("sleeping %v before retrying", delay) sleeper(delay) // TODO add random splay delay = delay * 2 |