From 3051e6fe4bbd498e3f63508de21a25b8045873f5 Mon Sep 17 00:00:00 2001 From: mikespook Date: Tue, 12 Jun 2012 12:22:20 +0800 Subject: [PATCH] tweaking --HG-- branch : dev --- worker/job.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/worker/job.go b/worker/job.go index 71d9ce5..e3cebe0 100644 --- a/worker/job.go +++ b/worker/job.go @@ -46,15 +46,14 @@ func decodeJob(data []byte) (job *Job, err error) { // Encode a job to byte slice func (job *Job) Encode() (data []byte) { l := len(job.Data) - tl := l if job.Handle != "" { - tl += len(job.Handle) + 1 + l += len(job.Handle) + 1 } - data = make([]byte, 0, tl + 12) + data = make([]byte, 0, l + 12) magiccode := common.Uint32ToBytes(job.magicCode) datatype := common.Uint32ToBytes(job.DataType) - datalength := common.Uint32ToBytes(uint32(tl)) + datalength := common.Uint32ToBytes(uint32(l)) data = append(data, magiccode[:]...) data = append(data, datatype[:]...)