Skip to content
Snippets Groups Projects
Commit 4c96e1c3 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

add logs to receive in xxdk-wasm

parent 78723dc1
No related branches found
No related tags found
1 merge request!67fix for latest client release
This commit is part of merge request !67. Comments created here will be created in the context of that merge request.
...@@ -98,6 +98,7 @@ func (w *wasmModel) Receive(messageID message.ID, nickname string, text []byte, ...@@ -98,6 +98,7 @@ func (w *wasmModel) Receive(messageID message.ID, nickname string, text []byte,
pubKey ed25519.PublicKey, dmToken uint32, codeset uint8, timestamp time.Time, pubKey ed25519.PublicKey, dmToken uint32, codeset uint8, timestamp time.Time,
round rounds.Round, mType dm.MessageType, status dm.Status) uint64 { round rounds.Round, mType dm.MessageType, status dm.Status) uint64 {
parentErr := errors.New("failed to Receive") parentErr := errors.New("failed to Receive")
jww.TRACE.Printf("[DM indexedDB] Receive(%s)", messageID)
// If there is no extant Conversation, create one. // If there is no extant Conversation, create one.
_, err := impl.Get(w.db, conversationStoreName, utils.CopyBytesToJS(pubKey)) _, err := impl.Get(w.db, conversationStoreName, utils.CopyBytesToJS(pubKey))
...@@ -132,6 +133,8 @@ func (w *wasmModel) Receive(messageID message.ID, nickname string, text []byte, ...@@ -132,6 +133,8 @@ func (w *wasmModel) Receive(messageID message.ID, nickname string, text []byte,
jww.ERROR.Printf("Failed to receive Message: %+v", err) jww.ERROR.Printf("Failed to receive Message: %+v", err)
} }
jww.TRACE.Printf("[DM indexedDB] Calling ReceiveMessageCB(%v, %v, f)",
uuid, pubKey)
go w.receivedMessageCB(uuid, pubKey, false) go w.receivedMessageCB(uuid, pubKey, false)
return uuid return uuid
} }
...@@ -140,6 +143,7 @@ func (w *wasmModel) ReceiveText(messageID message.ID, nickname, text string, ...@@ -140,6 +143,7 @@ func (w *wasmModel) ReceiveText(messageID message.ID, nickname, text string,
pubKey ed25519.PublicKey, dmToken uint32, codeset uint8, pubKey ed25519.PublicKey, dmToken uint32, codeset uint8,
timestamp time.Time, round rounds.Round, status dm.Status) uint64 { timestamp time.Time, round rounds.Round, status dm.Status) uint64 {
parentErr := errors.New("failed to ReceiveText") parentErr := errors.New("failed to ReceiveText")
jww.TRACE.Printf("[DM indexedDB] ReceiveText(%s)", messageID)
// If there is no extant Conversation, create one. // If there is no extant Conversation, create one.
_, err := impl.Get(w.db, conversationStoreName, utils.CopyBytesToJS(pubKey)) _, err := impl.Get(w.db, conversationStoreName, utils.CopyBytesToJS(pubKey))
...@@ -176,6 +180,8 @@ func (w *wasmModel) ReceiveText(messageID message.ID, nickname, text string, ...@@ -176,6 +180,8 @@ func (w *wasmModel) ReceiveText(messageID message.ID, nickname, text string,
jww.ERROR.Printf("Failed to receive Message: %+v", err) jww.ERROR.Printf("Failed to receive Message: %+v", err)
} }
jww.TRACE.Printf("[DM indexedDB] Calling ReceiveMessageCB(%v, %v, f)",
uuid, pubKey)
go w.receivedMessageCB(uuid, pubKey, false) go w.receivedMessageCB(uuid, pubKey, false)
return uuid return uuid
} }
...@@ -184,6 +190,7 @@ func (w *wasmModel) ReceiveReply(messageID, reactionTo message.ID, nickname, ...@@ -184,6 +190,7 @@ func (w *wasmModel) ReceiveReply(messageID, reactionTo message.ID, nickname,
text string, pubKey ed25519.PublicKey, dmToken uint32, codeset uint8, text string, pubKey ed25519.PublicKey, dmToken uint32, codeset uint8,
timestamp time.Time, round rounds.Round, status dm.Status) uint64 { timestamp time.Time, round rounds.Round, status dm.Status) uint64 {
parentErr := errors.New("failed to ReceiveReply") parentErr := errors.New("failed to ReceiveReply")
jww.TRACE.Printf("[DM indexedDB] ReceiveReply(%s)", messageID)
// If there is no extant Conversation, create one. // If there is no extant Conversation, create one.
_, err := impl.Get(w.db, conversationStoreName, utils.CopyBytesToJS(pubKey)) _, err := impl.Get(w.db, conversationStoreName, utils.CopyBytesToJS(pubKey))
...@@ -220,6 +227,8 @@ func (w *wasmModel) ReceiveReply(messageID, reactionTo message.ID, nickname, ...@@ -220,6 +227,8 @@ func (w *wasmModel) ReceiveReply(messageID, reactionTo message.ID, nickname,
jww.ERROR.Printf("Failed to receive Message: %+v", err) jww.ERROR.Printf("Failed to receive Message: %+v", err)
} }
jww.TRACE.Printf("[DM indexedDB] Calling ReceiveMessageCB(%v, %v, f)",
uuid, pubKey)
go w.receivedMessageCB(uuid, pubKey, false) go w.receivedMessageCB(uuid, pubKey, false)
return uuid return uuid
} }
...@@ -228,6 +237,7 @@ func (w *wasmModel) ReceiveReaction(messageID, _ message.ID, nickname, ...@@ -228,6 +237,7 @@ func (w *wasmModel) ReceiveReaction(messageID, _ message.ID, nickname,
reaction string, pubKey ed25519.PublicKey, dmToken uint32, codeset uint8, reaction string, pubKey ed25519.PublicKey, dmToken uint32, codeset uint8,
timestamp time.Time, round rounds.Round, status dm.Status) uint64 { timestamp time.Time, round rounds.Round, status dm.Status) uint64 {
parentErr := errors.New("failed to ReceiveText") parentErr := errors.New("failed to ReceiveText")
jww.TRACE.Printf("[DM indexedDB] ReceiveReaction(%s)", messageID)
// If there is no extant Conversation, create one. // If there is no extant Conversation, create one.
_, err := impl.Get(w.db, conversationStoreName, utils.CopyBytesToJS(pubKey)) _, err := impl.Get(w.db, conversationStoreName, utils.CopyBytesToJS(pubKey))
...@@ -264,6 +274,8 @@ func (w *wasmModel) ReceiveReaction(messageID, _ message.ID, nickname, ...@@ -264,6 +274,8 @@ func (w *wasmModel) ReceiveReaction(messageID, _ message.ID, nickname,
jww.ERROR.Printf("Failed to receive Message: %+v", err) jww.ERROR.Printf("Failed to receive Message: %+v", err)
} }
jww.TRACE.Printf("[DM indexedDB] Calling ReceiveMessageCB(%v, %v, f)",
uuid, pubKey)
go w.receivedMessageCB(uuid, pubKey, false) go w.receivedMessageCB(uuid, pubKey, false)
return uuid return uuid
} }
...@@ -277,6 +289,8 @@ func (w *wasmModel) UpdateSentStatus(uuid uint64, messageID message.ID, ...@@ -277,6 +289,8 @@ func (w *wasmModel) UpdateSentStatus(uuid uint64, messageID message.ID,
// special version of receiveHelper) // special version of receiveHelper)
w.updateMux.Lock() w.updateMux.Lock()
defer w.updateMux.Unlock() defer w.updateMux.Unlock()
jww.TRACE.Printf("[DM indexedDB] UpdateSentStatus(%d, %s, ...)",
uuid, messageID)
// Convert messageID to the key generated by json.Marshal // Convert messageID to the key generated by json.Marshal
key := js.ValueOf(uuid) key := js.ValueOf(uuid)
...@@ -316,6 +330,9 @@ func (w *wasmModel) UpdateSentStatus(uuid uint64, messageID message.ID, ...@@ -316,6 +330,9 @@ func (w *wasmModel) UpdateSentStatus(uuid uint64, messageID message.ID,
if err != nil { if err != nil {
jww.ERROR.Printf("%+v", errors.Wrap(parentErr, err.Error())) jww.ERROR.Printf("%+v", errors.Wrap(parentErr, err.Error()))
} }
jww.TRACE.Printf("[DM indexedDB] Calling ReceiveMessageCB(%v, %v, t)",
uuid, newMessage.ConversationPubKey)
go w.receivedMessageCB(uuid, newMessage.ConversationPubKey, true) go w.receivedMessageCB(uuid, newMessage.ConversationPubKey, true)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment