From 963b99b5e6031b3e39b4bcced0816192b65efc5a Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Fri, 3 Sep 2021 14:42:34 -0700 Subject: [PATCH] Fix map return --- protocol/connections/engine.go | 10 +++++----- protocol/connections/peerapp.go | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/protocol/connections/engine.go b/protocol/connections/engine.go index b85ed49..0671bd7 100644 --- a/protocol/connections/engine.go +++ b/protocol/connections/engine.go @@ -260,18 +260,18 @@ func (e *engine) createPeerTemplate() *PeerApp { // peerApp should not store state... guarded by a hostname peerAppTemplate.RequestMapLookup = func(hostname, key string) (string, bool) { - val, ok := e.getValRequests.Load(hostname+key) + val, ok := e.getValRequests.Load(hostname + key) if ok { valStr := val.(string) - return valStr, false + return valStr, true } return "", false } - peerAppTemplate.RequestMapStore = func(hostname,key string, value string) { - e.getValRequests.Store(hostname+key, value) + peerAppTemplate.RequestMapStore = func(hostname, key string, value string) { + e.getValRequests.Store(hostname + key, value) } peerAppTemplate.RequestMapDelete = func(hostname, key string) { - e.getValRequests.Delete(hostname+key) + e.getValRequests.Delete(hostname + key) } return peerAppTemplate } diff --git a/protocol/connections/peerapp.go b/protocol/connections/peerapp.go index 573a76b..7e240cf 100644 --- a/protocol/connections/peerapp.go +++ b/protocol/connections/peerapp.go @@ -27,7 +27,7 @@ type PeerApp struct { // Allow Peer App to look up Values associated with a particular connection... RequestMapStore func(string, string, string) RequestMapLookup func(string, string) (string, bool) - RequestMapDelete func(string, string) + RequestMapDelete func(string, string) } type peerGetVal struct { @@ -124,4 +124,3 @@ func (pa *PeerApp) SendMessage(message model2.PeerMessage) error { } return err } -