File Sharing MVP #384

Merged
sarah merged 52 commits from filesharing into master 2021-09-30 00:57:14 +00:00
2 changed files with 6 additions and 7 deletions
Showing only changes of commit 963b99b5e6 - Show all commits

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
}