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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
cea80688
Commit
cea80688
authored
Aug 27, 2021
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
Add event reports for user discovery
parent
60fd10e3
No related branches found
No related tags found
3 merge requests
!23
Release
,
!13
Hotfix/no host cooldown + return sende2e TS
,
!11
Client Event Reporting API
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
single/receiveResponse.go
+13
-2
13 additions, 2 deletions
single/receiveResponse.go
single/transmission.go
+9
-3
9 additions, 3 deletions
single/transmission.go
ud/register.go
+5
-0
5 additions, 0 deletions
ud/register.go
ud/search.go
+13
-0
13 additions, 0 deletions
ud/search.go
with
40 additions
and
5 deletions
single/receiveResponse.go
+
13
−
2
View file @
cea80688
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
package
single
package
single
import
(
import
(
"fmt"
"github.com/pkg/errors"
"github.com/pkg/errors"
jww
"github.com/spf13/jwalterweatherman"
jww
"github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/interfaces/message"
"gitlab.com/elixxir/client/interfaces/message"
...
@@ -37,8 +38,13 @@ func (m *Manager) receiveResponseHandler(rawMessages chan message.Receive,
...
@@ -37,8 +38,13 @@ func (m *Manager) receiveResponseHandler(rawMessages chan message.Receive,
// Process CMIX message
// Process CMIX message
err
:=
m
.
processesResponse
(
msg
.
RecipientID
,
msg
.
EphemeralID
,
msg
.
Payload
)
err
:=
m
.
processesResponse
(
msg
.
RecipientID
,
msg
.
EphemeralID
,
msg
.
Payload
)
if
err
!=
nil
{
if
err
!=
nil
{
jww
.
WARN
.
Printf
(
"Failed to read single-use CMIX message "
+
em
:=
fmt
.
Sprintf
(
"Failed to read single-use "
+
"response: %+v"
,
err
)
"CMIX message response: %+v"
,
err
)
jww
.
WARN
.
Print
(
em
)
if
m
.
client
!=
nil
{
m
.
client
.
ReportEvent
(
9
,
"SingleUse"
,
"Error"
,
em
)
}
}
}
}
}
}
}
...
@@ -89,6 +95,11 @@ func (m *Manager) processesResponse(rid *id.ID, ephID ephemeral.Id,
...
@@ -89,6 +95,11 @@ func (m *Manager) processesResponse(rid *id.ID, ephID ephemeral.Id,
// Once all message parts have been received delete and close everything
// Once all message parts have been received delete and close everything
if
collated
{
if
collated
{
if
m
.
client
!=
nil
{
m
.
client
.
ReportEvent
(
1
,
"SingleUse"
,
"MessageReceived"
,
fmt
.
Sprintf
(
"Single use response received "
+
"from %s"
,
rid
))
}
jww
.
DEBUG
.
Print
(
"Received all parts of single-use response message."
)
jww
.
DEBUG
.
Print
(
"Received all parts of single-use response message."
)
// Exit the timeout handler
// Exit the timeout handler
state
.
quitChan
<-
struct
{}{}
state
.
quitChan
<-
struct
{}{}
...
...
This diff is collapsed.
Click to expand it.
single/transmission.go
+
9
−
3
View file @
cea80688
...
@@ -113,7 +113,8 @@ func (m *Manager) transmitSingleUse(partner contact2.Contact, payload []byte,
...
@@ -113,7 +113,8 @@ func (m *Manager) transmitSingleUse(partner contact2.Contact, payload []byte,
go
func
()
{
go
func
()
{
// Send Message
// Send Message
jww
.
DEBUG
.
Printf
(
"Sending single-use transmission CMIX message to %s."
,
partner
.
ID
)
jww
.
DEBUG
.
Printf
(
"Sending single-use transmission CMIX "
+
"message to %s."
,
partner
.
ID
)
round
,
_
,
err
:=
m
.
net
.
SendCMIX
(
cmixMsg
,
partner
.
ID
,
params
.
GetDefaultCMIX
())
round
,
_
,
err
:=
m
.
net
.
SendCMIX
(
cmixMsg
,
partner
.
ID
,
params
.
GetDefaultCMIX
())
if
err
!=
nil
{
if
err
!=
nil
{
errorString
:=
fmt
.
Sprintf
(
"failed to send single-use transmission "
+
errorString
:=
fmt
.
Sprintf
(
"failed to send single-use transmission "
+
...
@@ -144,8 +145,13 @@ func (m *Manager) transmitSingleUse(partner contact2.Contact, payload []byte,
...
@@ -144,8 +145,13 @@ func (m *Manager) transmitSingleUse(partner contact2.Contact, payload []byte,
roundEvents
.
AddRoundEventChan
(
round
,
sendResults
,
roundEventTimeout
,
roundEvents
.
AddRoundEventChan
(
round
,
sendResults
,
roundEventTimeout
,
states
.
COMPLETED
,
states
.
FAILED
)
states
.
COMPLETED
,
states
.
FAILED
)
jww
.
DEBUG
.
Printf
(
"Sent single-use transmission CMIX message to %s and "
+
im
:=
fmt
.
Sprintf
(
"Sent single-use transmission CMIX "
+
"ephemeral ID %d on round %d."
,
partner
.
ID
,
ephID
.
Int64
(),
round
)
"message to %s and ephemeral ID %d on round %d."
,
partner
.
ID
,
ephID
.
Int64
(),
round
)
jww
.
DEBUG
.
Print
(
im
)
if
m
.
client
!=
nil
{
m
.
client
.
ReportEvent
(
1
,
"SingleUse"
,
"MessageSend"
,
im
)
}
// Wait until the result tracking responds
// Wait until the result tracking responds
success
,
numRoundFail
,
numTimeOut
:=
utility
.
TrackResults
(
sendResults
,
1
)
success
,
numRoundFail
,
numTimeOut
:=
utility
.
TrackResults
(
sendResults
,
1
)
...
...
This diff is collapsed.
Click to expand it.
ud/register.go
+
5
−
0
View file @
cea80688
package
ud
package
ud
import
(
import
(
"fmt"
"github.com/pkg/errors"
"github.com/pkg/errors"
jww
"github.com/spf13/jwalterweatherman"
jww
"github.com/spf13/jwalterweatherman"
pb
"gitlab.com/elixxir/comms/mixmessages"
pb
"gitlab.com/elixxir/comms/mixmessages"
...
@@ -85,6 +86,10 @@ func (m *Manager) register(username string, comm registerUserComms) error {
...
@@ -85,6 +86,10 @@ func (m *Manager) register(username string, comm registerUserComms) error {
if
err
==
nil
{
if
err
==
nil
{
err
=
m
.
setRegistered
()
err
=
m
.
setRegistered
()
if
m
.
client
!=
nil
{
m
.
client
.
ReportEvent
(
1
,
"UserDiscovery"
,
"Registration"
,
fmt
.
Sprintf
(
"User Registered with UD: %s"
,
user
))
}
}
}
return
err
return
err
...
...
This diff is collapsed.
Click to expand it.
ud/search.go
+
13
−
0
View file @
cea80688
package
ud
package
ud
import
(
import
(
"fmt"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/proto"
"github.com/pkg/errors"
"github.com/pkg/errors"
jww
"github.com/spf13/jwalterweatherman"
jww
"github.com/spf13/jwalterweatherman"
...
@@ -50,11 +51,17 @@ func (m *Manager) Search(list fact.FactList, callback searchCallback, timeout ti
...
@@ -50,11 +51,17 @@ func (m *Manager) Search(list fact.FactList, callback searchCallback, timeout ti
return
errors
.
WithMessage
(
err
,
"Failed to transmit search request."
)
return
errors
.
WithMessage
(
err
,
"Failed to transmit search request."
)
}
}
if
m
.
client
!=
nil
{
m
.
client
.
ReportEvent
(
1
,
"UserDiscovery"
,
"SearchRequest"
,
fmt
.
Sprintf
(
"Sent: %+v"
,
request
))
}
return
nil
return
nil
}
}
func
(
m
*
Manager
)
searchResponseHandler
(
factMap
map
[
string
]
fact
.
Fact
,
func
(
m
*
Manager
)
searchResponseHandler
(
factMap
map
[
string
]
fact
.
Fact
,
callback
searchCallback
,
payload
[]
byte
,
err
error
)
{
callback
searchCallback
,
payload
[]
byte
,
err
error
)
{
if
err
!=
nil
{
if
err
!=
nil
{
go
callback
(
nil
,
errors
.
WithMessage
(
err
,
"Failed to search."
))
go
callback
(
nil
,
errors
.
WithMessage
(
err
,
"Failed to search."
))
return
return
...
@@ -66,6 +73,12 @@ func (m *Manager) searchResponseHandler(factMap map[string]fact.Fact,
...
@@ -66,6 +73,12 @@ func (m *Manager) searchResponseHandler(factMap map[string]fact.Fact,
jww
.
WARN
.
Printf
(
"Dropped a search response from user discovery due to "
+
jww
.
WARN
.
Printf
(
"Dropped a search response from user discovery due to "
+
"failed unmarshal: %s"
,
err
)
"failed unmarshal: %s"
,
err
)
}
}
if
m
.
client
!=
nil
{
m
.
client
.
ReportEvent
(
1
,
"UserDiscovery"
,
"SearchResponse"
,
fmt
.
Sprintf
(
"Received: %+v"
,
searchResponse
))
}
if
searchResponse
.
Error
!=
""
{
if
searchResponse
.
Error
!=
""
{
err
=
errors
.
Errorf
(
"User Discovery returned an error on search: %s"
,
err
=
errors
.
Errorf
(
"User Discovery returned an error on search: %s"
,
searchResponse
.
Error
)
searchResponse
.
Error
)
...
...
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