The first workable version, both worker and client.

This commit is contained in:
mikespook 2011-05-22 22:16:30 +08:00
parent f6d2a16685
commit b4a6f133e1
2 changed files with 8 additions and 13 deletions

View File

@ -40,13 +40,4 @@ func main() {
} else {
log.Println("Not running")
}
log.Println("read")
if job, err := client.ReadJob(); err != nil {
log.Println(err)
} else {
data, err := job.Result();
log.Println(err)
log.Println(data)
}
}

View File

@ -4,7 +4,7 @@ import (
"os"
"net"
"sync"
// "log"
"log"
"strconv"
)
@ -182,8 +182,12 @@ func (client *Client) Status(handle string) (known, running bool, numerator, den
}
known = data[1][0] == '1'
running = data[2][0] == '1'
numerator = uint(data[3][0])
denominator = uint(data[4][0])
if numerator, err = strconv.Atoui(string(data[3][0])); err != nil {
return
}
if denominator, err = strconv.Atoui(string(data[4][0])); err != nil {
return
}
return
}
@ -195,7 +199,7 @@ func (client *Client) Echo(data []byte) (echo []byte, err os.Error) {
if job, err = client.readLastJob(ECHO_RES); err != nil {
return
}
echo, err = job.Result()
echo = job.Data
return
}