Update and Receive status correctly

This commit is contained in:
Paul Mach 2013-04-23 11:45:57 -07:00
parent 011c3253f7
commit f3b4013e2b
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.Known = (data[1][0] == '1')
status.Running = (data[2][0] == '1') status.Running = (data[2][0] == '1')
var err error 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 { if err != nil {
client.err(common.Errorf("Invalid handle: %s", data[3][0])) client.err(common.Errorf("Invalid Integer: %s", data[3]))
return 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 { if err != nil {
client.err(common.Errorf("Invalid handle: %s", data[4][0])) client.err(common.Errorf("Invalid Integer: %s", data[4]))
return return
} }
client.status <- status client.status <- status

View File

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