github.com/ava-labs/avalanchego@v1.11.11/network/throttling/no_inbound_msg_throttler.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package throttling
     5  
     6  import (
     7  	"context"
     8  
     9  	"github.com/ava-labs/avalanchego/ids"
    10  )
    11  
    12  var _ InboundMsgThrottler = (*noInboundMsgThrottler)(nil)
    13  
    14  // Returns an InboundMsgThrottler where Acquire() always returns immediately.
    15  func NewNoInboundThrottler() InboundMsgThrottler {
    16  	return &noInboundMsgThrottler{}
    17  }
    18  
    19  // [Acquire] always returns immediately.
    20  type noInboundMsgThrottler struct{}
    21  
    22  func (*noInboundMsgThrottler) Acquire(context.Context, uint64, ids.NodeID) ReleaseFunc {
    23  	return noopRelease
    24  }
    25  
    26  func (*noInboundMsgThrottler) AddNode(ids.NodeID) {}
    27  
    28  func (*noInboundMsgThrottler) RemoveNode(ids.NodeID) {}