Skip to content

Commit

Permalink
connect static nodes (#1016)
Browse files Browse the repository at this point in the history
* update buildall.bat

* use static nodes to connect

* set getDebtByHash api to be public

* Check if nodeId is empty

* node start config maxConns and maxActiveConns

* set maxConnsPerShardPerIp

* set max connections limit for single IP

* fix log import bug

* init log

* set message log level to debug

* fix ipSet bug

* fix set maxActiveConnections bug

* limit peer announceRequestCode frequency

* log sendAnnounce entry

* test chainHeaderChange not sendAnnounce every time

* remove other requestTime limits, just in blockLoop, for Test

* clean code and refactor

* fix some typos

* limit peer handling announceCode frequency

* log handshaked peerNodeID

* add log

* vm toll add fee parameter and fix nonce bug

* add seele rpc api getShardNum

* try to connect static node if its config likes "snode://nodeid@ip:port[shardNum]"
  • Loading branch information
avadesian authored and LincolnZeng committed Oct 4, 2019
1 parent 6e44e4d commit 84461cf
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions p2p/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,26 +351,14 @@ running:
// doSelectNodeToConnect selects one free node from nodeMap to connect
func (srv *Server) doSelectNodeToConnect() {

var nodeID [maxConnsPerShard]*discovery.Node
index := 0
for _, node := range srv.StaticNodes {
if node.ID.IsEmpty() || srv.checkPeerExist(node.ID) {
continue
} else {
nodeID[index] = node
index++
srv.connectNode(node)
}

}
srv.nodeSet.lock.RLock()
for i := 0; i < index; i++ {
if _, ok := srv.nodeSet.nodeMap[nodeID[i].ID]; ok {
srv.connectNode(nodeID[i])

}

}
srv.nodeSet.lock.RUnlock()
var node *discovery.Node
i := 0
for i < maxConnsPerShard {
Expand Down

0 comments on commit 84461cf

Please sign in to comment.