Rename variables in copyJobs()
This commit is contained in:
parent
cd0c537e7e
commit
71f3fb2dac
1 changed files with 15 additions and 15 deletions
28
archiver.go
28
archiver.go
|
@ -469,30 +469,30 @@ type archivePipe struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func copyJobs(done <-chan struct{}, in <-chan pipe.Job, out chan<- pipe.Job) {
|
func copyJobs(done <-chan struct{}, in <-chan pipe.Job, out chan<- pipe.Job) {
|
||||||
i := in
|
|
||||||
o := out
|
|
||||||
|
|
||||||
o = nil
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
j pipe.Job
|
// 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
|
ok bool
|
||||||
)
|
)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-done:
|
case <-done:
|
||||||
return
|
return
|
||||||
case j, ok = <-i:
|
case job, ok = <-inCh:
|
||||||
if !ok {
|
if !ok {
|
||||||
// in ch closed, we're done
|
// input channel closed, we're done
|
||||||
debug.Log("copyJobs", "in channel closed, we're done")
|
debug.Log("copyJobs", "input channel closed, we're done")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
i = nil
|
inCh = nil
|
||||||
o = out
|
outCh = out
|
||||||
case o <- j:
|
case outCh <- job:
|
||||||
o = nil
|
outCh = nil
|
||||||
i = in
|
inCh = in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue