Send Indexed Failure on Send Error
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Sarah Jamie Lewis 2021-12-18 17:38:17 -08:00
parent c035ab52bc
commit 59d54d790d
1 changed files with 4 additions and 3 deletions

View File

@ -1245,9 +1245,9 @@ func (cp *cwtchPeer) attemptAcknowledgeP2PConversation(handle string, signature
// to either find the contact or the associated message
func (cp *cwtchPeer) attemptErrorConversationMessage(handle string, signature string, eventType event.Type, error string) error {
ci, err := cp.FetchConversationInfo(handle)
// We should *never* received a peer acknowledgement for a conversation that doesn't exist...
// We should *never* received an error for a conversation that doesn't exist...
if ci != nil && err == nil {
// for p2p messages the randomly generated event ID is the "signature"
// "signature" here is event ID for peer messages...
id, err := cp.GetChannelMessageBySignature(ci.ID, 0, signature)
if err == nil {
_, attr, err := cp.GetChannelMessage(ci.ID, 0, id)
@ -1256,7 +1256,8 @@ func (cp *cwtchPeer) attemptErrorConversationMessage(handle string, signature st
attr[constants.AttrErr] = constants.True
cp.storage.UpdateMessageAttributes(ci.ID, 0, id, attr)
cp.mutex.Unlock()
cp.eventBus.Publish(event.NewEvent(eventType, map[event.Field]string{event.ConversationID: strconv.Itoa(ci.ID), event.RemotePeer: handle, event.Error: error, event.Index: strconv.Itoa(id)}))
// Send a generic indexed failure...
cp.eventBus.Publish(event.NewEvent(event.IndexedFailure, map[event.Field]string{event.ConversationID: strconv.Itoa(ci.ID), event.Handle: handle, event.Error: error, event.Index: strconv.Itoa(id)}))
return nil
}
return err