forked from yuxh/gearman-go
tweaking
--HG-- branch : dev
This commit is contained in:
parent
79c4bc2e47
commit
3051e6fe4b
@ -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[:]...)
|
||||
|
Loading…
Reference in New Issue
Block a user