mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-18 02:48:40 +00:00
ipn: remove an unnecessary lazy map init on read path
It's okay to read from a nil map. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
7e7c4c1bbe
commit
22cac33fe7
@ -67,9 +67,6 @@ func (s *MemoryStore) String() string { return "MemoryStore" }
|
|||||||
func (s *MemoryStore) ReadState(id StateKey) ([]byte, error) {
|
func (s *MemoryStore) ReadState(id StateKey) ([]byte, error) {
|
||||||
s.mu.Lock()
|
s.mu.Lock()
|
||||||
defer s.mu.Unlock()
|
defer s.mu.Unlock()
|
||||||
if s.cache == nil {
|
|
||||||
s.cache = map[StateKey][]byte{}
|
|
||||||
}
|
|
||||||
bs, ok := s.cache[id]
|
bs, ok := s.cache[id]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, ErrStateNotExist
|
return nil, ErrStateNotExist
|
||||||
|
Loading…
x
Reference in New Issue
Block a user