Skip to content

Commit

Permalink
Added p.Done() to all protocols
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoAndreSa committed Jun 27, 2018
1 parent 94e197d commit c8f72de
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 8 deletions.
5 changes: 4 additions & 1 deletion protocols/addrm_server_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
package protocolsunlynx

import (
"sync"

"github.com/dedis/kyber"
"github.com/dedis/onet"
"github.com/dedis/onet/log"
"github.com/lca1/unlynx/lib"
"github.com/lca1/unlynx/lib/proofs"
"sync"
)

// AddRmServerProtocolName is the registered name for the local aggregation protocol.
Expand Down Expand Up @@ -89,6 +90,8 @@ func (p *AddRmServerProtocol) Start() error {

// Dispatch is called on each node. It waits for incoming messages and handle them.
func (p *AddRmServerProtocol) Dispatch() error {
defer p.Done()

aux := <-finalResultAddrm
p.FeedbackChannel <- aux
return nil
Expand Down
4 changes: 3 additions & 1 deletion protocols/collective_aggregation_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ package protocolsunlynx
import (
"errors"

"sync"

"github.com/dedis/onet"
"github.com/dedis/onet/log"
"github.com/dedis/onet/network"
"github.com/lca1/unlynx/lib"
"github.com/lca1/unlynx/lib/proofs"
"sync"
)

// CollectiveAggregationProtocolName is the registered name for the collective aggregation protocol.
Expand Down Expand Up @@ -137,6 +138,7 @@ func (p *CollectiveAggregationProtocol) Start() error {

// Dispatch is called at each node and handle incoming messages.
func (p *CollectiveAggregationProtocol) Dispatch() error {
defer p.Done()

// 1. Aggregation announcement phase
if !p.IsRoot() {
Expand Down
7 changes: 5 additions & 2 deletions protocols/deterministic_tagging_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ package protocolsunlynx

import (
"errors"
"sync"
"time"

"github.com/dedis/kyber"
"github.com/dedis/onet"
"github.com/dedis/onet/log"
"github.com/dedis/onet/network"
"github.com/lca1/unlynx/lib"
"github.com/lca1/unlynx/lib/proofs"
"sync"
"time"
)

// DeterministicTaggingProtocolName is the registered name for the deterministic tagging protocol.
Expand Down Expand Up @@ -148,6 +149,8 @@ func (p *DeterministicTaggingProtocol) Start() error {

// Dispatch is called on each tree node. It waits for incoming messages and handles them.
func (p *DeterministicTaggingProtocol) Dispatch() error {
defer p.Done()

//************ ----- first round, add value derivated from ephemeral secret to message ---- ********************
deterministicTaggingTargetBytesBef := <-p.PreviousNodeInPathChannel
deterministicTaggingTargetBef := DeterministicTaggingMessage{Data: make([]libunlynx.CipherText, 0)}
Expand Down
7 changes: 5 additions & 2 deletions protocols/key_switching_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ package protocolsunlynx

import (
"errors"
"sync"
"time"

"github.com/dedis/kyber"
"github.com/dedis/onet"
"github.com/dedis/onet/log"
"github.com/dedis/onet/network"
"github.com/lca1/unlynx/lib"
"github.com/lca1/unlynx/lib/proofs"
"sync"
"time"
)

// KeySwitchingProtocolName is the registered name for the key switching protocol.
Expand Down Expand Up @@ -183,6 +184,8 @@ func getAttributesAndEphemKeys(ct libunlynx.CipherText) (libunlynx.CipherText, k

// Dispatch is called on each node. It waits for incoming messages and handles them.
func (p *KeySwitchingProtocol) Dispatch() error {
defer p.Done()

message := <-p.PreviousNodeInPathChannel
keySwitchingTargetBytes := message.KeySwitchedCipherBytesMessage.Data
keySwitchingTarget := &KeySwitchedCipherMessage{}
Expand Down
6 changes: 4 additions & 2 deletions protocols/shuffling_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ package protocolsunlynx
import (
"errors"

"sync"
"time"

"github.com/dedis/kyber"
"github.com/dedis/onet"
"github.com/dedis/onet/log"
"github.com/dedis/onet/network"
"github.com/lca1/unlynx/lib"
"github.com/lca1/unlynx/lib/proofs"
"sync"
"time"
)

// ShufflingProtocolName is the registered name for the neff shuffle protocol.
Expand Down Expand Up @@ -183,6 +184,7 @@ func (p *ShufflingProtocol) Start() error {

// Dispatch is called on each tree node. It waits for incoming messages and handles them.
func (p *ShufflingProtocol) Dispatch() error {
defer p.Done()

shufflingLength := <-p.LengthNodeChannel

Expand Down
2 changes: 2 additions & 0 deletions protocols/utils/local_aggregation_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ func (p *LocalAggregationProtocol) Start() error {

// Dispatch is called on each node. It waits for incoming messages and handle them.
func (p *LocalAggregationProtocol) Dispatch() error {
defer p.Done()

aux := <-finalResultAggr
p.FeedbackChannel <- aux
return nil
Expand Down
2 changes: 2 additions & 0 deletions protocols/utils/local_clear_aggregation_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ func (p *LocalClearAggregationProtocol) Start() error {

// Dispatch is called on each node. It waits for incoming messages and handle them.
func (p *LocalClearAggregationProtocol) Dispatch() error {
defer p.Done()

aux := <-finalResultClearAggr
p.FeedbackChannel <- aux
return nil
Expand Down
2 changes: 2 additions & 0 deletions protocols/utils/proofs_verification_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ func (p *ProofsVerificationProtocol) Start() error {

// Dispatch is called on each node. It waits for incoming messages and handle them.
func (p *ProofsVerificationProtocol) Dispatch() error {
defer p.Done()

aux := <-finalResult
p.FeedbackChannel <- aux
return nil
Expand Down

0 comments on commit c8f72de

Please sign in to comment.