Fix map return
This commit is contained in:
parent
1d3f44a79f
commit
963b99b5e6
|
@ -260,18 +260,18 @@ func (e *engine) createPeerTemplate() *PeerApp {
|
||||||
|
|
||||||
// peerApp should not store state... guarded by a hostname
|
// peerApp should not store state... guarded by a hostname
|
||||||
peerAppTemplate.RequestMapLookup = func(hostname, key string) (string, bool) {
|
peerAppTemplate.RequestMapLookup = func(hostname, key string) (string, bool) {
|
||||||
val, ok := e.getValRequests.Load(hostname+key)
|
val, ok := e.getValRequests.Load(hostname + key)
|
||||||
if ok {
|
if ok {
|
||||||
valStr := val.(string)
|
valStr := val.(string)
|
||||||
return valStr, false
|
return valStr, true
|
||||||
}
|
}
|
||||||
return "", false
|
return "", false
|
||||||
}
|
}
|
||||||
peerAppTemplate.RequestMapStore = func(hostname,key string, value string) {
|
peerAppTemplate.RequestMapStore = func(hostname, key string, value string) {
|
||||||
e.getValRequests.Store(hostname+key, value)
|
e.getValRequests.Store(hostname + key, value)
|
||||||
}
|
}
|
||||||
peerAppTemplate.RequestMapDelete = func(hostname, key string) {
|
peerAppTemplate.RequestMapDelete = func(hostname, key string) {
|
||||||
e.getValRequests.Delete(hostname+key)
|
e.getValRequests.Delete(hostname + key)
|
||||||
}
|
}
|
||||||
return peerAppTemplate
|
return peerAppTemplate
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ type PeerApp struct {
|
||||||
// Allow Peer App to look up Values associated with a particular connection...
|
// Allow Peer App to look up Values associated with a particular connection...
|
||||||
RequestMapStore func(string, string, string)
|
RequestMapStore func(string, string, string)
|
||||||
RequestMapLookup func(string, string) (string, bool)
|
RequestMapLookup func(string, string) (string, bool)
|
||||||
RequestMapDelete func(string, string)
|
RequestMapDelete func(string, string)
|
||||||
}
|
}
|
||||||
|
|
||||||
type peerGetVal struct {
|
type peerGetVal struct {
|
||||||
|
@ -124,4 +124,3 @@ func (pa *PeerApp) SendMessage(message model2.PeerMessage) error {
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue