Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

Commit

Permalink
go fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
kortatu committed Sep 27, 2019
1 parent 29303f1 commit e53ae25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions network/kademlialoadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type KademliaLoadBalancer struct {
unsubscribeNotifier func() //an unsubscribe function provided when subscribe to kademlia notifiers
quitC chan struct{}

initCountFunc func(peer *Peer, po int) int //Function to use for initializing a new peer count
initCountFunc func(peer *Peer, po int) int //Function to use for initializing a new peer count
}

// Stop unsubscribe from notifiers
Expand Down Expand Up @@ -190,7 +190,6 @@ func (klb *KademliaLoadBalancer) mostSimilarPeerCount(newPeer *Peer, _ int) int
return count
}


func (klb *KademliaLoadBalancer) removedPeer(peer *Peer) {
klb.resourceUseStats.lock.Lock()
defer klb.resourceUseStats.lock.Lock()
Expand Down
8 changes: 4 additions & 4 deletions network/kademlialoadbalancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestAddedNodesMostSimilar(t *testing.T) {
fourthUses := klb.resourceUseStats.getUses(fourth)
thirdUses = klb.resourceUseStats.getUses(third)
if fourthUses != thirdUses {
t.Errorf("Expected %v use for new peer because most similiar is peer 3. Instead %v", thirdUses, fourthUses)
t.Errorf("Expected %v use for new peer because most similar is peer 3. Instead %v", thirdUses, fourthUses)
}

}
Expand Down Expand Up @@ -226,15 +226,15 @@ func (tkb *testKademliaBackend) EachConn(base []byte, maxPo int, consume func(*P
return
}
}
for i := po + 1; po < maxPo ; po++ {
for i := po + 1; po < maxPo; po++ {
bin = tkb.bins[i]
for _, peer := range bin {
if !consume(peer, po) {
return
}
}
}
for i := po - 1; po >= 0 ; po-- {
for i := po - 1; po >= 0; po-- {
bin = tkb.bins[i]
for _, peer := range bin {
if !consume(peer, i) {
Expand Down Expand Up @@ -330,7 +330,7 @@ func (tkb *testKademliaBackend) removePeer(peer *Peer) {
for i, aPeer := range bin {
if aPeer == peer {
tkb.bins[po] = append(bin[:i], bin[i+1:]...)
if len(tkb.bins[po]) == 0 && tkb.maxPo >= po{
if len(tkb.bins[po]) == 0 && tkb.maxPo >= po {
tkb.updateMaxPo()
}
break
Expand Down

0 comments on commit e53ae25

Please sign in to comment.