Refactor PrepareUserMessage function to store message after processing outbound user message, store is destructive for a usermessage
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
ycc 2024-04-06 10:13:25 +02:00
parent 99a9aa14af
commit 2513f0303a

View File

@ -20,8 +20,6 @@ func PrepareUserMessage(message string, srvuid string, peer_idx int, filelist []
return nil, "PrepareServerMessage : AddFile", err return nil, "PrepareServerMessage : AddFile", err
} }
} }
// Store message
peer.StoreMessage(usermessage, filelist)
// Prepare cyphered + packed user message // Prepare cyphered + packed user message
packedMsg, err := peer.ProcessOutboundUserMessage(usermessage) packedMsg, err := peer.ProcessOutboundUserMessage(usermessage)
if err != nil { if err != nil {
@ -33,5 +31,10 @@ func PrepareUserMessage(message string, srvuid string, peer_idx int, filelist []
if err != nil { if err != nil {
return nil, "PrepareServerMessage : ProcessOutboundMessage", err return nil, "PrepareServerMessage : ProcessOutboundMessage", err
} }
// Store message
err = peer.StoreMessage(usermessage, filelist)
if err != nil {
return nil, "PrepareServerMessage : StoreMessage", err
}
return data, "", nil return data, "", nil
} }