mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
swarm/pss: WIP amend PR comments by @zelig
This commit is contained in:
parent
bc2a4b866f
commit
92bafbf4a0
2 changed files with 13 additions and 10 deletions
|
|
@ -91,15 +91,15 @@ func NewKadParams() *KadParams {
|
|||
// Kademlia is a table of live peers and a db of known peers (node records)
|
||||
type Kademlia struct {
|
||||
lock sync.RWMutex
|
||||
*KadParams // Kademlia configuration parameters
|
||||
base []byte // immutable baseaddress of the table
|
||||
addrs *pot.Pot // pots container for known peer addresses
|
||||
conns *pot.Pot // pots container for live peer connections
|
||||
depth uint8 // stores the last current depth of saturation
|
||||
nDepth int // stores the last neighbourhood depth
|
||||
nDepthC chan int // returned by DepthC function to signal neighbourhood depth change
|
||||
addrCountC chan int // returned by AddrCountC function to signal peer count change
|
||||
Pof func(pot.Val, pot.Val, int) (int, bool)
|
||||
*KadParams // Kademlia configuration parameters
|
||||
base []byte // immutable baseaddress of the table
|
||||
addrs *pot.Pot // pots container for known peer addresses
|
||||
conns *pot.Pot // pots container for live peer connections
|
||||
depth uint8 // stores the last current depth of saturation
|
||||
nDepth int // stores the last neighbourhood depth
|
||||
nDepthC chan int // returned by DepthC function to signal neighbourhood depth change
|
||||
addrCountC chan int // returned by AddrCountC function to signal peer count change
|
||||
Pof func(pot.Val, pot.Val, int) (int, bool) // function for calculating kademlia routing distance between two addresses
|
||||
}
|
||||
|
||||
// NewKademlia creates a Kademlia table for base address addr
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ func NewAPI(ps *Pss) *API {
|
|||
//
|
||||
// All incoming messages to the node matching this topic will be encapsulated in the APIMsg
|
||||
// struct and sent to the subscriber
|
||||
func (pssapi *API) Receive(ctx context.Context, topic Topic, raw bool) (*rpc.Subscription, error) {
|
||||
func (pssapi *API) Receive(ctx context.Context, topic Topic, raw bool, prox bool) (*rpc.Subscription, error) {
|
||||
notifier, supported := rpc.NotifierFromContext(ctx)
|
||||
if !supported {
|
||||
return nil, fmt.Errorf("Subscribe not supported")
|
||||
|
|
@ -75,6 +75,9 @@ func (pssapi *API) Receive(ctx context.Context, topic Topic, raw bool) (*rpc.Sub
|
|||
if raw {
|
||||
hndlr.caps |= handlerCapRaw
|
||||
}
|
||||
if prox {
|
||||
hndlr.caps |= handlerCapProx
|
||||
}
|
||||
|
||||
deregf := pssapi.Register(&topic, hndlr)
|
||||
go func() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue