Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xxdk-wasm
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
xxdk-wasm
Commits
c716ff37
Commit
c716ff37
authored
2 years ago
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
refuse to work when message ID is all 0s
parent
6af1b074
No related branches found
No related tags found
2 merge requests
!60
Revert "Fail a test to be sure it works"
,
!8
Updates to match the client fullyDecentrilizedChannels branch
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indexedDb/implementation.go
+22
-0
22 additions, 0 deletions
indexedDb/implementation.go
with
22 additions
and
0 deletions
indexedDb/implementation.go
+
22
−
0
View file @
c716ff37
...
...
@@ -160,10 +160,23 @@ func (w *wasmModel) ReceiveMessage(channelID *id.ID,
if
err
!=
nil
{
jww
.
ERROR
.
Printf
(
"%+v"
,
errors
.
Wrap
(
parentErr
,
err
.
Error
()))
}
if
checkZero
(
messageID
.
Bytes
())
{
jww
.
FATAL
.
Panicf
(
"Empty message ID is impossible!"
)
}
go
w
.
receivedMessageCB
(
uuid
,
channelID
)
return
uuid
}
func
checkZero
(
b
[]
byte
)
bool
{
for
i
:=
0
;
i
<
len
(
b
);
i
++
{
if
b
[
i
]
!=
0
{
return
false
}
}
return
true
}
// ReceiveReply is called whenever a message is received that is a reply on a
// given channel. It may be called multiple times on the same message; it is
// incumbent on the user of the API to filter such called by message ID.
...
...
@@ -183,6 +196,9 @@ func (w *wasmModel) ReceiveReply(channelID *id.ID,
if
err
!=
nil
{
jww
.
ERROR
.
Printf
(
"%+v"
,
errors
.
Wrap
(
parentErr
,
err
.
Error
()))
}
if
checkZero
(
messageID
.
Bytes
())
{
jww
.
FATAL
.
Panicf
(
"Empty message ID is impossible!"
)
}
go
w
.
receivedMessageCB
(
uuid
,
channelID
)
return
uuid
}
...
...
@@ -205,6 +221,9 @@ func (w *wasmModel) ReceiveReaction(channelID *id.ID, messageID cryptoChannel.Me
if
err
!=
nil
{
jww
.
ERROR
.
Printf
(
"%+v"
,
errors
.
Wrap
(
parentErr
,
err
.
Error
()))
}
if
checkZero
(
messageID
.
Bytes
())
{
jww
.
FATAL
.
Panicf
(
"Empty message ID is impossible!"
)
}
go
w
.
receivedMessageCB
(
uuid
,
channelID
)
return
uuid
}
...
...
@@ -246,6 +265,9 @@ func (w *wasmModel) UpdateSentStatus(uuid uint64, messageID cryptoChannel.Messag
}
channelID
:=
&
id
.
ID
{}
copy
(
channelID
[
:
],
newMessage
.
ChannelID
)
if
checkZero
(
messageID
.
Bytes
())
{
jww
.
FATAL
.
Panicf
(
"Empty message ID is impossible!"
)
}
go
w
.
receivedMessageCB
(
uuid
,
channelID
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment