Merge pull request #15 from paulmach/master

Update and Receive status correctly
This commit is contained in:
Xing 2013-04-23 19:04:37 -07:00
commit 2107c9b883
2 changed files with 5 additions and 4 deletions

View File

@ -265,14 +265,14 @@ func (client *Client) handleStatus(job *Job) {
status.Known = (data[1][0] == '1')
status.Running = (data[2][0] == '1')
var err error
status.Numerator, err = strconv.ParseUint(string(data[3][0]), 10, 0)
status.Numerator, err = strconv.ParseUint(string(data[3]), 10, 0)
if err != nil {
client.err(common.Errorf("Invalid handle: %s", data[3][0]))
client.err(common.Errorf("Invalid Integer: %s", data[3]))
return
}
status.Denominator, err = strconv.ParseUint(string(data[4][0]), 10, 0)
status.Denominator, err = strconv.ParseUint(string(data[4]), 10, 0)
if err != nil {
client.err(common.Errorf("Invalid handle: %s", data[4][0]))
client.err(common.Errorf("Invalid Integer: %s", data[4]))
return
}
client.status <- status

View File

@ -112,6 +112,7 @@ func (job *Job) UpdateStatus(numerator, denominator int) {
d := []byte(strconv.Itoa(denominator))
result := append([]byte(job.Handle), 0)
result = append(result, n...)
result = append(result, '\x00')
result = append(result, d...)
job.agent.WriteJob(newJob(common.REQ, common.WORK_STATUS, result))
}