mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 04:06:44 +00:00
add hive to protocol constructors
This commit is contained in:
parent
d82157ec86
commit
c3add4001c
1 changed files with 4 additions and 3 deletions
|
|
@ -141,22 +141,23 @@ main entrypoint, wrappers starting a server running the bzz protocol
|
||||||
use this constructor to attach the protocol ("class") to server caps
|
use this constructor to attach the protocol ("class") to server caps
|
||||||
the Dev p2p layer then runs the protocol instance on each peer
|
the Dev p2p layer then runs the protocol instance on each peer
|
||||||
*/
|
*/
|
||||||
func BzzProtocol(netStore *netStore) p2p.Protocol {
|
func BzzProtocol(netStore *netStore, hive *hive) p2p.Protocol {
|
||||||
return p2p.Protocol{
|
return p2p.Protocol{
|
||||||
Name: "bzz",
|
Name: "bzz",
|
||||||
Version: Version,
|
Version: Version,
|
||||||
Length: ProtocolLength,
|
Length: ProtocolLength,
|
||||||
Run: func(p *p2p.Peer, rw p2p.MsgReadWriter) error {
|
Run: func(p *p2p.Peer, rw p2p.MsgReadWriter) error {
|
||||||
return runBzzProtocol(netStore, p, rw)
|
return runBzzProtocol(netStore, hive, p, rw)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// the main loop that handles incoming messages
|
// the main loop that handles incoming messages
|
||||||
// note RemovePeer in the post-disconnect hook
|
// note RemovePeer in the post-disconnect hook
|
||||||
func runBzzProtocol(netStore *netStore, p *p2p.Peer, rw p2p.MsgReadWriter) (err error) {
|
func runBzzProtocol(netStore *netStore, hive *hive, p *p2p.Peer, rw p2p.MsgReadWriter) (err error) {
|
||||||
self := &bzzProtocol{
|
self := &bzzProtocol{
|
||||||
netStore: netStore,
|
netStore: netStore,
|
||||||
|
hive: hive,
|
||||||
rw: rw,
|
rw: rw,
|
||||||
peer: p,
|
peer: p,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue