minor fixes
This commit is contained in:
parent
d41cbbd817
commit
c327b6b456
3 changed files with 7 additions and 5 deletions
|
@ -37,7 +37,8 @@ const (
|
|||
|
||||
udpRetry = 3
|
||||
udpTimeout = 5 * time.Second
|
||||
udpMaxMessageLength = 1024 // bytes. I think our longest message is ~676 bytes, so I rounded up
|
||||
udpMaxMessageLength = 4096 // bytes. I think our longest message is ~676 bytes, so I rounded up to 1024
|
||||
// scratch that. a findValue could return more than K results if a lot of nodes are storing that value, so we need more buffer
|
||||
|
||||
maxPeerFails = 3 // after this many failures, a peer is considered bad and will be removed from the routing table
|
||||
//tExpire = 60 * time.Minute // the time after which a key/value pair expires; this is a time-to-live (TTL) from the original publication date
|
||||
|
|
|
@ -384,13 +384,14 @@ type SendOptions struct {
|
|||
// SendAsync sends a transaction and returns a channel that will eventually contain the transaction response
|
||||
// The response channel is closed when the transaction is completed or times out.
|
||||
func (n *Node) SendAsync(ctx context.Context, contact Contact, req Request, options ...SendOptions) <-chan *Response {
|
||||
ch := make(chan *Response, 1)
|
||||
|
||||
if contact.ID.Equals(n.id) {
|
||||
log.Error("sending query to self")
|
||||
return nil
|
||||
close(ch)
|
||||
return ch
|
||||
}
|
||||
|
||||
ch := make(chan *Response, 1)
|
||||
|
||||
go func() {
|
||||
defer close(ch)
|
||||
|
||||
|
|
|
@ -351,7 +351,7 @@ func appendContacts(contacts []sortedContact, b bucket, target bits.Bitmap) []so
|
|||
func (rt *routingTable) Count() int {
|
||||
count := 0
|
||||
for _, bucket := range rt.buckets {
|
||||
count = bucket.Len()
|
||||
count += bucket.Len()
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue