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
|
|
@ -99,7 +99,7 @@ type Kademlia struct {
|
||||||
nDepth int // stores the last neighbourhood depth
|
nDepth int // stores the last neighbourhood depth
|
||||||
nDepthC chan int // returned by DepthC function to signal neighbourhood depth change
|
nDepthC chan int // returned by DepthC function to signal neighbourhood depth change
|
||||||
addrCountC chan int // returned by AddrCountC function to signal peer count change
|
addrCountC chan int // returned by AddrCountC function to signal peer count change
|
||||||
Pof func(pot.Val, pot.Val, int) (int, bool)
|
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
|
// 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
|
// All incoming messages to the node matching this topic will be encapsulated in the APIMsg
|
||||||
// struct and sent to the subscriber
|
// 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)
|
notifier, supported := rpc.NotifierFromContext(ctx)
|
||||||
if !supported {
|
if !supported {
|
||||||
return nil, fmt.Errorf("Subscribe not 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 {
|
if raw {
|
||||||
hndlr.caps |= handlerCapRaw
|
hndlr.caps |= handlerCapRaw
|
||||||
}
|
}
|
||||||
|
if prox {
|
||||||
|
hndlr.caps |= handlerCapProx
|
||||||
|
}
|
||||||
|
|
||||||
deregf := pssapi.Register(&topic, hndlr)
|
deregf := pssapi.Register(&topic, hndlr)
|
||||||
go func() {
|
go func() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue