MCPcopy Create free account
hub / github.com/DNAProject/DNA / NewServer

Function NewServer

p2pserver/p2pserver.go:73–88  ·  view source on GitHub ↗

NewServer return a new p2pserver according to the pubkey

()

Source from the content-addressed store, hash-verified

71
72//NewServer return a new p2pserver according to the pubkey
73func NewServer() *P2PServer {
74 n := netserver.NewNetServer()
75
76 p := &P2PServer{
77 network: n,
78 ledger: ledger.DefLedger,
79 }
80
81 p.msgRouter = utils.NewMsgRouter(p.network)
82 p.blockSync = NewBlockSyncMgr(p)
83 p.recentPeers = make(map[uint32][]string)
84 p.quitSyncRecent = make(chan bool)
85 p.quitOnline = make(chan bool)
86 p.quitHeartBeat = make(chan bool)
87 return p
88}
89
90//GetConnectionCnt return the established connect count
91func (this *P2PServer) GetConnectionCnt() uint32 {

Callers 3

initP2PNodeFunction · 0.92
TestP2PActorServerFunction · 0.92
TestNewP2PServerFunction · 0.85

Calls 3

NewNetServerFunction · 0.92
NewMsgRouterFunction · 0.92
NewBlockSyncMgrFunction · 0.85

Tested by 2

TestP2PActorServerFunction · 0.74
TestNewP2PServerFunction · 0.68