File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -129,3 +129,18 @@ func (pd *FloodsubPeerDiscovery) broadcast() error {
129
129
}
130
130
return nil
131
131
}
132
+
133
+ func (pd * FloodsubPeerDiscovery ) ReadLoop (ctx context.Context , subs * pubsub.Subscription ) error {
134
+ for {
135
+ msg , err := subs .Next (ctx )
136
+ if err != nil {
137
+ return err
138
+ }
139
+
140
+ if msg .ReceivedFrom == pd .PeerID .ID {
141
+ continue
142
+ }
143
+
144
+ log .Info ().Msgf ("found a floodsub discovery message | %v" , err )
145
+ }
146
+ }
Original file line number Diff line number Diff line change @@ -147,6 +147,12 @@ func (p *P2PNode) Run(
147
147
runner .Go (func () error {
148
148
return p .FloodSubDiscovery .Start (ctx )
149
149
})
150
+
151
+ for _ , subs := range p .FloodSubDiscovery .Subscription {
152
+ runner .Go (func () error {
153
+ return p .FloodSubDiscovery .ReadLoop (ctx , subs )
154
+ })
155
+ }
150
156
}
151
157
runner .Go (func () error {
152
158
log .Info ().Str ("namespace" , p .config .DiscoveryNamespace ).Msg ("starting advertizing discovery node" )
You can’t perform that action at this time.
0 commit comments