mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 07:58:22 -05:00
Add Status to P2P Service interface
This commit is contained in:
@@ -51,6 +51,10 @@ func (*FakeP2P) GossipDialer() gossipcrawler.GossipDialer {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (*FakeP2P) Status() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddDisconnectionHandler -- fake.
|
||||
func (*FakeP2P) AddDisconnectionHandler(_ func(ctx context.Context, id peer.ID) error) {
|
||||
}
|
||||
|
||||
@@ -111,6 +111,10 @@ func NewTestP2P(t *testing.T, userOptions ...config.Option) *TestP2P {
|
||||
}
|
||||
}
|
||||
|
||||
func (p TestP2P) Status() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Connect two test peers together.
|
||||
func (p *TestP2P) Connect(b *TestP2P) {
|
||||
if err := connect(p.BHost, b.BHost); err != nil {
|
||||
|
||||
@@ -417,11 +417,11 @@ func (s *Service) startDiscoveryAndSubscriptions() {
|
||||
if s.cfg.p2p.Status() == nil {
|
||||
break
|
||||
}
|
||||
log.Debug("p2p service not started yet; will retry in 100ms")
|
||||
log.Debug("P2P service not started yet; will retry in 100ms")
|
||||
|
||||
select {
|
||||
case <-s.ctx.Done():
|
||||
log.WithError(s.ctx.Err()).Error("context closed while waiting for p2p service to start, exiting startDiscoveryAndSubscriptions routine")
|
||||
log.WithError(s.ctx.Err()).Error("Context closed while waiting for P2P service to start, exiting startDiscoveryAndSubscriptions routine")
|
||||
return
|
||||
case <-time.After(100 * time.Millisecond):
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user