Skip to content

Commit

Permalink
[udp/server] remove unused response cache
Browse files Browse the repository at this point in the history
The UDP server implementation creates a response message cache and
periodically checks for expirations, but nothing is ever loaded or
stored in the cache.

Signed-off-by: Daniel Mangum <[email protected]>
  • Loading branch information
hasheddan authored and jkralik committed Nov 7, 2024
1 parent 91a04ea commit 2404bac
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions udp/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/plgd-dev/go-coap/v3/net/blockwise"
"github.com/plgd-dev/go-coap/v3/net/monitor/inactivity"
"github.com/plgd-dev/go-coap/v3/net/responsewriter"
"github.com/plgd-dev/go-coap/v3/pkg/cache"
coapSync "github.com/plgd-dev/go-coap/v3/pkg/sync"
"github.com/plgd-dev/go-coap/v3/udp/client"
)
Expand All @@ -27,7 +26,6 @@ type Server struct {
serverStartedChan chan struct{}
doneCancel context.CancelFunc
cancel context.CancelFunc
responseMsgCache *cache.Cache[string, []byte]

connsMutex sync.Mutex
conns map[string]*client.Conn
Expand Down Expand Up @@ -92,7 +90,6 @@ func New(opt ...Option) *Server {
serverStartedChan: serverStartedChan,
doneCtx: doneCtx,
doneCancel: doneCancel,
responseMsgCache: cache.NewCache[string, []byte](),
conns: make(map[string]*client.Conn),

cfg: &cfg,
Expand Down Expand Up @@ -140,7 +137,6 @@ func (s *Server) Serve(l *coapNet.UDPConn) error {

s.cfg.PeriodicRunner(func(now time.Time) bool {
s.handleInactivityMonitors(now)
s.responseMsgCache.CheckExpirations(now)
return s.ctx.Err() == nil
})

Expand Down

0 comments on commit 2404bac

Please sign in to comment.