[lxc-devel] [lxd/master] Bugfixes
stgraber on Github
lxc-bot at linuxcontainers.org
Tue Mar 28 21:26:11 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170328/2019e071/attachment.bin>
-------------- next part --------------
From 380e65ef78c7fce18ec92e7b52eb81715e208776 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 28 Mar 2017 17:04:44 -0400
Subject: [PATCH] operations: Remove useless for loops
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/operations.go | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/lxd/operations.go b/lxd/operations.go
index f285d05..517652b 100644
--- a/lxd/operations.go
+++ b/lxd/operations.go
@@ -283,23 +283,19 @@ func (op *operation) WaitFinal(timeout int) (bool, error) {
// Wait indefinitely
if timeout == -1 {
- for {
- <-op.chanDone
- return true, nil
- }
+ <-op.chanDone
+ return true, nil
}
// Wait until timeout
if timeout > 0 {
timer := time.NewTimer(time.Duration(timeout) * time.Second)
- for {
- select {
- case <-op.chanDone:
- return false, nil
+ select {
+ case <-op.chanDone:
+ return false, nil
- case <-timer.C:
- return false, nil
- }
+ case <-timer.C:
+ return false, nil
}
}
More information about the lxc-devel
mailing list