From 71f3fb2dac947ec00d358e347a1532291596935b Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sat, 2 May 2015 16:36:48 +0200 Subject: [PATCH] Rename variables in copyJobs() --- archiver.go | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/archiver.go b/archiver.go index 301ec9471..7f2cc11a8 100644 --- a/archiver.go +++ b/archiver.go @@ -469,30 +469,30 @@ type archivePipe struct { } func copyJobs(done <-chan struct{}, in <-chan pipe.Job, out chan<- pipe.Job) { - i := in - o := out - - o = nil - var ( - j pipe.Job - ok bool + // disable sending on the outCh until we received a job + outCh chan<- pipe.Job + // enable receiving from in + inCh = in + job pipe.Job + ok bool ) + for { select { case <-done: return - case j, ok = <-i: + case job, ok = <-inCh: if !ok { - // in ch closed, we're done - debug.Log("copyJobs", "in channel closed, we're done") + // input channel closed, we're done + debug.Log("copyJobs", "input channel closed, we're done") return } - i = nil - o = out - case o <- j: - o = nil - i = in + inCh = nil + outCh = out + case outCh <- job: + outCh = nil + inCh = in } } }