go fmt
This commit is contained in:
parent
2b4cc002d1
commit
2ee2be0891
@ -7,8 +7,8 @@ package worker
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ func (inpack *inPack) SendData(data []byte) {
|
|||||||
l := hl + len(data) + 1
|
l := hl + len(data) + 1
|
||||||
outpack.data = getBuffer(l)
|
outpack.data = getBuffer(l)
|
||||||
copy(outpack.data, []byte(inpack.handle))
|
copy(outpack.data, []byte(inpack.handle))
|
||||||
copy(outpack.data[hl + 1:], data)
|
copy(outpack.data[hl+1:], data)
|
||||||
inpack.a.write(outpack)
|
inpack.a.write(outpack)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ func (inpack *inPack) SendWarning(data []byte) {
|
|||||||
l := hl + len(data) + 1
|
l := hl + len(data) + 1
|
||||||
outpack.data = getBuffer(l)
|
outpack.data = getBuffer(l)
|
||||||
copy(outpack.data, []byte(inpack.handle))
|
copy(outpack.data, []byte(inpack.handle))
|
||||||
copy(outpack.data[hl + 1:], data)
|
copy(outpack.data[hl+1:], data)
|
||||||
inpack.a.write(outpack)
|
inpack.a.write(outpack)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +70,6 @@ func (inpack *inPack) UpdateStatus(numerator, denominator int) {
|
|||||||
inpack.a.write(outpack)
|
inpack.a.write(outpack)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Decode job from byte slice
|
// Decode job from byte slice
|
||||||
func decodeInPack(data []byte) (inpack *inPack, l int, err error) {
|
func decodeInPack(data []byte) (inpack *inPack, l int, err error) {
|
||||||
if len(data) < MIN_PACKET_LEN { // valid package should not less 12 bytes
|
if len(data) < MIN_PACKET_LEN { // valid package should not less 12 bytes
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
package worker
|
package worker
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"time"
|
|
||||||
"sync"
|
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
"fmt"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -78,7 +78,7 @@ func (worker *Worker) AddServer(net, addr string) (err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
worker.agents[net + addr] = a
|
worker.agents[net+addr] = a
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ func (worker *Worker) addFunc(funcname string, timeout uint32) {
|
|||||||
outpack.data = getBuffer(l + 5)
|
outpack.data = getBuffer(l + 5)
|
||||||
copy(outpack.data, []byte(funcname))
|
copy(outpack.data, []byte(funcname))
|
||||||
outpack.data[l] = '\x00'
|
outpack.data[l] = '\x00'
|
||||||
binary.BigEndian.PutUint32(outpack.data[l + 1:], timeout)
|
binary.BigEndian.PutUint32(outpack.data[l+1:], timeout)
|
||||||
}
|
}
|
||||||
worker.broadcast(outpack)
|
worker.broadcast(outpack)
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package worker
|
package worker
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
var worker *Worker
|
var worker *Worker
|
||||||
|
Loading…
Reference in New Issue
Block a user