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
a3515308
Commit
a3515308
authored
Apr 9, 2021
by
Benjamin Wenger
Browse files
Options
Downloads
Patches
Plain Diff
removed last usage of cleanup stoppers
parent
52611fb1
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
keyExchange/confirm.go
+2
-1
2 additions, 1 deletion
keyExchange/confirm.go
keyExchange/exchange.go
+11
-15
11 additions, 15 deletions
keyExchange/exchange.go
keyExchange/trigger.go
+2
-1
2 additions, 1 deletion
keyExchange/trigger.go
with
15 additions
and
17 deletions
keyExchange/confirm.go
+
2
−
1
View file @
a3515308
...
...
@@ -18,10 +18,11 @@ import (
)
func
startConfirm
(
sess
*
storage
.
Session
,
c
chan
message
.
Receive
,
stop
*
stoppable
.
Single
)
{
stop
*
stoppable
.
Single
,
cleanup
func
()
)
{
for
true
{
select
{
case
<-
stop
.
Quit
()
:
cleanup
()
return
case
confirmation
:=
<-
c
:
handleConfirm
(
sess
,
confirmation
)
...
...
This diff is collapsed.
Click to expand it.
keyExchange/exchange.go
+
11
−
15
View file @
a3515308
...
...
@@ -15,7 +15,6 @@ import (
"gitlab.com/elixxir/client/storage"
"gitlab.com/elixxir/client/switchboard"
"gitlab.com/xx_network/primitives/id"
"time"
)
const
keyExchangeTriggerName
=
"KeyExchangeTrigger"
...
...
@@ -32,14 +31,13 @@ func Start(switchboard *switchboard.Switchboard, sess *storage.Session, net inte
// create the trigger stoppable
triggerStop
:=
stoppable
.
NewSingle
(
keyExchangeTriggerName
)
triggerStopCleanup
:=
stoppable
.
NewCleanup
(
triggerStop
,
func
(
duration
time
.
Duration
)
error
{
cleanupTrigger
:=
func
()
{
switchboard
.
Unregister
(
triggerID
)
return
nil
})
}
// start the trigger thread
go
startTrigger
(
sess
,
net
,
triggerCh
,
triggerStop
,
params
)
go
startTrigger
(
sess
,
net
,
triggerCh
,
triggerStop
,
params
,
cleanupTrigger
)
//register the rekey confirm thread
confirmCh
:=
make
(
chan
message
.
Receive
,
100
)
...
...
@@ -48,18 +46,16 @@ func Start(switchboard *switchboard.Switchboard, sess *storage.Session, net inte
// register the confirm stoppable
confirmStop
:=
stoppable
.
NewSingle
(
keyExchangeConfirmName
)
confirmStopCleanup
:=
stoppable
.
NewCleanup
(
confirmStop
,
func
(
duration
time
.
Duration
)
error
{
cleanupConfirm
:=
func
(){
switchboard
.
Unregister
(
confirmID
)
return
nil
})
}
// start the confirm thread
go
startConfirm
(
sess
,
confirmCh
,
confirmStop
)
go
startConfirm
(
sess
,
confirmCh
,
confirmStop
,
cleanupConfirm
)
//bundle the stoppables and return
exchangeStop
:=
stoppable
.
NewMulti
(
keyExchangeMulti
)
exchangeStop
.
Add
(
triggerStop
Cleanup
)
exchangeStop
.
Add
(
confirmStop
Cleanup
)
exchangeStop
.
Add
(
triggerStop
)
exchangeStop
.
Add
(
confirmStop
)
return
exchangeStop
}
This diff is collapsed.
Click to expand it.
keyExchange/trigger.go
+
2
−
1
View file @
a3515308
...
...
@@ -31,10 +31,11 @@ const (
)
func
startTrigger
(
sess
*
storage
.
Session
,
net
interfaces
.
NetworkManager
,
c
chan
message
.
Receive
,
stop
*
stoppable
.
Single
,
params
params
.
Rekey
)
{
c
chan
message
.
Receive
,
stop
*
stoppable
.
Single
,
params
params
.
Rekey
,
cleanup
func
()
)
{
for
true
{
select
{
case
<-
stop
.
Quit
()
:
cleanup
()
return
case
request
:=
<-
c
:
go
func
()
{
...
...
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