Map logging
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:14:42 -07:00
parent 8e9ed132d8
commit 902b759e81
1 changed files with 2 additions and 0 deletions

View File

@ -89,6 +89,7 @@ func (pa *PeerApp) listen() {
case event.ContextAck:
pa.OnAcknowledgement(pa.connection.Hostname(), peerMessage.ID)
case event.ContextRetVal:
log.Infof("Loading from map %x", pa.getValRequests)
req, ok := pa.getValRequests.Load(peerMessage.ID)
if ok {
reqStr := []byte(req.(string))
@ -112,6 +113,7 @@ func (pa *PeerApp) listen() {
// NOTE: This is a stub, we will likely want to extend this to better reflect the desired protocol
func (pa *PeerApp) SendMessage(message model2.PeerMessage) error {
if message.Context == event.ContextGetVal {
log.Infof("Saving to map %x", pa.getValRequests)
pa.getValRequests.Store(message.ID, string(message.Data))
// sync map is apparently not guaranteed to be consistent
_, ok := pa.getValRequests.Load(message.ID)