Fix map return
continuous-integration/drone/push Build is pending Details
continuous-integration/drone/pr Build is pending Details

This commit is contained in:
Sarah Jamie Lewis 2021-09-03 14:42:34 -07:00
parent 1d3f44a79f
commit 963b99b5e6
2 changed files with 6 additions and 7 deletions

View File

@ -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
}

View File

@ -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
}