fixed the infinite loop issue

This commit is contained in:
mikespook 2012-05-28 10:56:01 +08:00
parent 16f134a30a
commit d2301626cd

View File

@ -36,8 +36,9 @@ func newAgent(addr string, worker *Worker) (a *agent, err error) {
// outputing loop
func (a *agent) outLoop() {
ok := true
var job *Job
for ok {
if job, ok := <-a.out; ok {
if job, ok = <-a.out; ok {
if err := a.write(job.Encode()); err != nil {
a.worker.err(err)
}