dht: Misc trivial improvements
This commit is contained in:
parent
9c7d3d4783
commit
621ec7bac4
|
@ -2,6 +2,7 @@ package dht
|
|||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"log"
|
||||
"math/big"
|
||||
"math/rand"
|
||||
"net"
|
||||
|
@ -48,6 +49,7 @@ const zeroID = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
|
|||
var testIDs []nodeID
|
||||
|
||||
func init() {
|
||||
log.SetFlags(log.Flags() | log.Lshortfile)
|
||||
for _, s := range []string{
|
||||
zeroID,
|
||||
"\x03" + zeroID[1:],
|
||||
|
@ -152,7 +154,7 @@ func TestServerCustomNodeId(t *testing.T) {
|
|||
|
||||
func TestAnnounceTimeout(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip()
|
||||
t.SkipNow()
|
||||
}
|
||||
s, err := NewServer(&ServerConfig{
|
||||
BootstrapNodes: []string{"1.2.3.4:5"},
|
||||
|
|
|
@ -380,7 +380,7 @@ func (s *Server) writeToNode(b []byte, node dHTAddr) (err error) {
|
|||
}
|
||||
n, err := s.socket.WriteTo(b, node.UDPAddr())
|
||||
if err != nil {
|
||||
err = fmt.Errorf("error writing %d bytes to %s: %#v", len(b), node, err)
|
||||
err = fmt.Errorf("error writing %d bytes to %s: %s", len(b), node, err)
|
||||
return
|
||||
}
|
||||
if n != len(b) {
|
||||
|
|
Loading…
Reference in New Issue