Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
client
Commits
15037876
Commit
15037876
authored
3 years ago
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
Add reports to sendCmix
parent
72a1e554
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!23
Release
,
!13
Hotfix/no host cooldown + return sende2e TS
,
!11
Client Event Reporting API
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
network/manager.go
+1
-0
1 addition, 0 deletions
network/manager.go
network/message/sendCmix.go
+13
-4
13 additions, 4 deletions
network/message/sendCmix.go
network/message/sendCmix_test.go
+7
-1
7 additions, 1 deletion
network/message/sendCmix_test.go
with
21 additions
and
5 deletions
network/manager.go
+
1
−
0
View file @
15037876
...
@@ -97,6 +97,7 @@ func NewManager(session *storage.Session, switchboard *switchboard.Switchboard,
...
@@ -97,6 +97,7 @@ func NewManager(session *storage.Session, switchboard *switchboard.Switchboard,
Instance
:
instance
,
Instance
:
instance
,
TransmissionID
:
session
.
User
()
.
GetCryptographicIdentity
()
.
GetTransmissionID
(),
TransmissionID
:
session
.
User
()
.
GetCryptographicIdentity
()
.
GetTransmissionID
(),
ReceptionID
:
session
.
User
()
.
GetCryptographicIdentity
()
.
GetReceptionID
(),
ReceptionID
:
session
.
User
()
.
GetCryptographicIdentity
()
.
GetReceptionID
(),
Events
:
events
,
}
}
// Set up gateway.Sender
// Set up gateway.Sender
...
...
This diff is collapsed.
Click to expand it.
network/message/sendCmix.go
+
13
−
4
View file @
15037876
...
@@ -8,9 +8,11 @@
...
@@ -8,9 +8,11 @@
package
message
package
message
import
(
import
(
"fmt"
"github.com/golang-collections/collections/set"
"github.com/golang-collections/collections/set"
"github.com/pkg/errors"
"github.com/pkg/errors"
jww
"github.com/spf13/jwalterweatherman"
jww
"github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/interfaces"
"gitlab.com/elixxir/client/interfaces/params"
"gitlab.com/elixxir/client/interfaces/params"
"gitlab.com/elixxir/client/network/gateway"
"gitlab.com/elixxir/client/network/gateway"
"gitlab.com/elixxir/client/stoppable"
"gitlab.com/elixxir/client/stoppable"
...
@@ -32,7 +34,8 @@ func (m *Manager) SendCMIX(sender *gateway.Sender, msg format.Message,
...
@@ -32,7 +34,8 @@ func (m *Manager) SendCMIX(sender *gateway.Sender, msg format.Message,
recipient
*
id
.
ID
,
param
params
.
CMIX
,
stop
*
stoppable
.
Single
)
(
id
.
Round
,
ephemeral
.
Id
,
error
)
{
recipient
*
id
.
ID
,
param
params
.
CMIX
,
stop
*
stoppable
.
Single
)
(
id
.
Round
,
ephemeral
.
Id
,
error
)
{
msgCopy
:=
msg
.
Copy
()
msgCopy
:=
msg
.
Copy
()
return
sendCmixHelper
(
sender
,
msgCopy
,
recipient
,
param
,
m
.
Instance
,
return
sendCmixHelper
(
sender
,
msgCopy
,
recipient
,
param
,
m
.
Instance
,
m
.
Session
,
m
.
nodeRegistration
,
m
.
Rng
,
m
.
TransmissionID
,
m
.
Comms
,
stop
)
m
.
Session
,
m
.
nodeRegistration
,
m
.
Rng
,
m
.
Internal
.
Events
,
m
.
TransmissionID
,
m
.
Comms
,
stop
)
}
}
// Helper function for sendCmix
// Helper function for sendCmix
...
@@ -47,7 +50,8 @@ func (m *Manager) SendCMIX(sender *gateway.Sender, msg format.Message,
...
@@ -47,7 +50,8 @@ func (m *Manager) SendCMIX(sender *gateway.Sender, msg format.Message,
func
sendCmixHelper
(
sender
*
gateway
.
Sender
,
msg
format
.
Message
,
func
sendCmixHelper
(
sender
*
gateway
.
Sender
,
msg
format
.
Message
,
recipient
*
id
.
ID
,
cmixParams
params
.
CMIX
,
instance
*
network
.
Instance
,
recipient
*
id
.
ID
,
cmixParams
params
.
CMIX
,
instance
*
network
.
Instance
,
session
*
storage
.
Session
,
nodeRegistration
chan
network
.
NodeGateway
,
session
*
storage
.
Session
,
nodeRegistration
chan
network
.
NodeGateway
,
rng
*
fastRNG
.
StreamGenerator
,
senderId
*
id
.
ID
,
comms
sendCmixCommsInterface
,
rng
*
fastRNG
.
StreamGenerator
,
events
interfaces
.
EventManager
,
senderId
*
id
.
ID
,
comms
sendCmixCommsInterface
,
stop
*
stoppable
.
Single
)
(
id
.
Round
,
ephemeral
.
Id
,
error
)
{
stop
*
stoppable
.
Single
)
(
id
.
Round
,
ephemeral
.
Id
,
error
)
{
timeStart
:=
netTime
.
Now
()
timeStart
:=
netTime
.
Now
()
...
@@ -144,8 +148,13 @@ func sendCmixHelper(sender *gateway.Sender, msg format.Message,
...
@@ -144,8 +148,13 @@ func sendCmixHelper(sender *gateway.Sender, msg format.Message,
// Return if it sends properly
// Return if it sends properly
gwSlotResp
:=
result
.
(
*
pb
.
GatewaySlotResponse
)
gwSlotResp
:=
result
.
(
*
pb
.
GatewaySlotResponse
)
if
gwSlotResp
.
Accepted
{
if
gwSlotResp
.
Accepted
{
jww
.
INFO
.
Printf
(
"Successfully sent to EphID %v (source: %s) "
+
m
:=
fmt
.
Sprintf
(
"Successfully sent to EphID %v "
+
"in round %d (msgDigest: %s)"
,
ephID
.
Int64
(),
recipient
,
bestRound
.
ID
,
msg
.
Digest
())
"(source: %s) in round %d (msgDigest: %s), "
+
"elapsed: %s numRoundTries: %d"
,
ephID
.
Int64
(),
recipient
,
bestRound
.
ID
,
msg
.
Digest
(),
elapsed
,
numRoundTries
)
jww
.
INFO
.
Print
(
m
)
events
.
Report
(
1
,
"MessageSend"
,
"Metric"
,
m
)
return
id
.
Round
(
bestRound
.
ID
),
ephID
,
nil
return
id
.
Round
(
bestRound
.
ID
),
ephID
,
nil
}
else
{
}
else
{
jww
.
FATAL
.
Panicf
(
"Gateway %s returned no error, but failed "
+
jww
.
FATAL
.
Panicf
(
"Gateway %s returned no error, but failed "
+
...
...
This diff is collapsed.
Click to expand it.
network/message/sendCmix_test.go
+
7
−
1
View file @
15037876
...
@@ -26,12 +26,18 @@ import (
...
@@ -26,12 +26,18 @@ import (
"time"
"time"
)
)
type
dummyEvent
struct
{}
func
(
e
*
dummyEvent
)
Report
(
priority
int
,
category
,
evtType
,
details
string
)
{}
// Unit test
// Unit test
func
Test_attemptSendCmix
(
t
*
testing
.
T
)
{
func
Test_attemptSendCmix
(
t
*
testing
.
T
)
{
sess1
:=
storage
.
InitTestingSession
(
t
)
sess1
:=
storage
.
InitTestingSession
(
t
)
sess2
:=
storage
.
InitTestingSession
(
t
)
sess2
:=
storage
.
InitTestingSession
(
t
)
events
:=
&
dummyEvent
{}
sw
:=
switchboard
.
New
()
sw
:=
switchboard
.
New
()
l
:=
TestListener
{
l
:=
TestListener
{
ch
:
make
(
chan
bool
),
ch
:
make
(
chan
bool
),
...
@@ -113,7 +119,7 @@ func Test_attemptSendCmix(t *testing.T) {
...
@@ -113,7 +119,7 @@ func Test_attemptSendCmix(t *testing.T) {
e2e
.
SetUnencrypted
(
msgCmix
,
m
.
Session
.
User
()
.
GetCryptographicIdentity
()
.
GetTransmissionID
())
e2e
.
SetUnencrypted
(
msgCmix
,
m
.
Session
.
User
()
.
GetCryptographicIdentity
()
.
GetTransmissionID
())
_
,
_
,
err
=
sendCmixHelper
(
sender
,
msgCmix
,
sess2
.
GetUser
()
.
ReceptionID
,
_
,
_
,
err
=
sendCmixHelper
(
sender
,
msgCmix
,
sess2
.
GetUser
()
.
ReceptionID
,
params
.
GetDefaultCMIX
(),
m
.
Instance
,
m
.
Session
,
m
.
nodeRegistration
,
params
.
GetDefaultCMIX
(),
m
.
Instance
,
m
.
Session
,
m
.
nodeRegistration
,
m
.
Rng
,
m
.
TransmissionID
,
&
MockSendCMIXComms
{
t
:
t
},
nil
)
m
.
Rng
,
events
,
m
.
TransmissionID
,
&
MockSendCMIXComms
{
t
:
t
},
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Failed to sendcmix: %+v"
,
err
)
t
.
Errorf
(
"Failed to sendcmix: %+v"
,
err
)
panic
(
"t"
)
panic
(
"t"
)
...
...
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