Skip to content

Commit

Permalink
Revert name to TIMEOUT because of golang naming convention (to avoid …
Browse files Browse the repository at this point in the history
…go lint error)
  • Loading branch information
JoaoAndreSa committed Mar 12, 2020
1 parent 186b6f4 commit 8563eee
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 25 deletions.
8 changes: 4 additions & 4 deletions lib/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
func init() {
tmp, err := time.ParseDuration(os.Getenv("MEDCO_TIMEOUT"))
if err == nil {
DefaultTimeout = tmp
TIMEOUT = tmp
} else {
log.Warn("Couldn't parse MEDCO_TIMEOUT, using default value: ", DefaultTimeout.String())
log.Warn("Couldn't parse MEDCO_TIMEOUT, using default value: ", TIMEOUT.String())
}
}

Expand All @@ -30,8 +30,8 @@ const VPARALLELIZE = 100
// DIFFPRI enables the DRO protocol (Distributed Results Obfuscation)
const DIFFPRI = false

// DefaultTimeout ddefines the default channel timeout
var DefaultTimeout = 10 * time.Minute
// TIMEOUT ddefines the default channel timeout
var TIMEOUT = 10 * time.Minute

// StartTimer starts measurement of time
func StartTimer(name string) *monitor.TimeMeasure {
Expand Down
2 changes: 1 addition & 1 deletion protocols/collective_aggregation_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func (p *CollectiveAggregationProtocol) aggregationAnnouncementPhase() error {
if err := p.SendToChildren(&dataReferenceMessage.DataReferenceMessage); err != nil {
return fmt.Errorf("error sending <DataReferenceMessage>: %v", err)
}
case <-time.After(libunlynx.DefaultTimeout):
case <-time.After(libunlynx.TIMEOUT):
return fmt.Errorf(p.ServerIdentity().String() + " didn't get the <dataReferenceMessage> on time")
}
return nil
Expand Down
4 changes: 2 additions & 2 deletions protocols/deterministic_tagging_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (p *DeterministicTaggingProtocol) Dispatch() error {
var deterministicTaggingTargetBytesBef deterministicTaggingBytesStruct
select {
case deterministicTaggingTargetBytesBef = <-p.PreviousNodeInPathChannel:
case <-time.After(libunlynx.DefaultTimeout):
case <-time.After(libunlynx.TIMEOUT):
return fmt.Errorf(p.ServerIdentity().String() + " didn't get the <deterministicTaggingTargetBytesBef> (first round) on time")
}

Expand Down Expand Up @@ -211,7 +211,7 @@ func (p *DeterministicTaggingProtocol) Dispatch() error {
var deterministicTaggingTargetBytes deterministicTaggingBytesStruct
select {
case deterministicTaggingTargetBytes = <-p.PreviousNodeInPathChannel:
case <-time.After(libunlynx.DefaultTimeout):
case <-time.After(libunlynx.TIMEOUT):
return fmt.Errorf(p.ServerIdentity().String() + " didn't get the <deterministicTaggingTargetBytes> (second round) on time")
}

Expand Down
2 changes: 1 addition & 1 deletion protocols/key_switching_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func (p *KeySwitchingProtocol) announcementKSPhase() (kyber.Point, []kyber.Point
var dataReferenceMessage DownBytesStruct
select {
case dataReferenceMessage = <-p.DownChannel:
case <-time.After(libunlynx.DefaultTimeout):
case <-time.After(libunlynx.TIMEOUT):
return nil, nil, fmt.Errorf(p.ServerIdentity().String() + " didn't get the <dataReferenceMessage> on time")
}

Expand Down
4 changes: 2 additions & 2 deletions protocols/shuffling+ddt_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ func (p *ShufflingPlusDDTProtocol) Dispatch() error {
var shufflingPlusDDTBytesMessageLength shufflingPlusDDTBytesLengthStruct
select {
case shufflingPlusDDTBytesMessageLength = <-p.LengthNodeChannel:
case <-time.After(libunlynx.DefaultTimeout):
case <-time.After(libunlynx.TIMEOUT):
return fmt.Errorf(p.ServerIdentity().String() + " didn't get the <shufflingPlusDDTBytesMessageLength> on time")
}

var tmp shufflingPlusDDTBytesStruct
select {
case tmp = <-p.PreviousNodeInPathChannel:
case <-time.After(libunlynx.DefaultTimeout):
case <-time.After(libunlynx.TIMEOUT):
return fmt.Errorf(p.ServerIdentity().String() + " didn't get the <tmp> on time")
}

Expand Down
4 changes: 2 additions & 2 deletions protocols/shuffling_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,14 @@ func (p *ShufflingProtocol) Dispatch() error {
var shufflingBytesMessageLength shufflingBytesLengthStruct
select {
case shufflingBytesMessageLength = <-p.LengthNodeChannel:
case <-time.After(libunlynx.DefaultTimeout):
case <-time.After(libunlynx.TIMEOUT):
return fmt.Errorf(p.ServerIdentity().String() + " didn't get the <shufflingBytesMessageLength> on time")
}

var tmp shufflingBytesStruct
select {
case tmp = <-p.PreviousNodeInPathChannel:
case <-time.After(libunlynx.DefaultTimeout):
case <-time.After(libunlynx.TIMEOUT):
return fmt.Errorf(p.ServerIdentity().String() + " didn't get the <tmp> on time")
}

Expand Down
2 changes: 1 addition & 1 deletion protocols/utils/addrm_server_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (p *AddRmServerProtocol) Dispatch() error {
var finalResultMessage []libunlynx.CipherText
select {
case finalResultMessage = <-finalResultAddrm:
case <-time.After(libunlynx.DefaultTimeout):
case <-time.After(libunlynx.TIMEOUT):
return fmt.Errorf(p.ServerIdentity().String() + " didn't get the <finalResultMessage> on time")
}

Expand Down
2 changes: 1 addition & 1 deletion protocols/utils/local_aggregation_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (p *LocalAggregationProtocol) Dispatch() error {
var finalResultMessage map[libunlynx.GroupingKey]libunlynx.FilteredResponse
select {
case finalResultMessage = <-finalResultAggr:
case <-time.After(libunlynx.DefaultTimeout):
case <-time.After(libunlynx.TIMEOUT):
return fmt.Errorf(p.ServerIdentity().String() + " didn't get the <finalResultMessage> on time")
}

Expand Down
2 changes: 1 addition & 1 deletion protocols/utils/local_clear_aggregation_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (p *LocalClearAggregationProtocol) Dispatch() error {
var finalResultMessage []libunlynx.DpClearResponse
select {
case finalResultMessage = <-finalResultClearAggr:
case <-time.After(libunlynx.DefaultTimeout):
case <-time.After(libunlynx.TIMEOUT):
return fmt.Errorf(p.ServerIdentity().String() + " didn't get the <finalResultMessage> on time")
}

Expand Down
2 changes: 1 addition & 1 deletion protocols/utils/proofs_verification_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (p *ProofsVerificationProtocol) Dispatch() error {
var finalResultMessage []bool
select {
case finalResultMessage = <-finalResult:
case <-time.After(libunlynx.DefaultTimeout):
case <-time.After(libunlynx.TIMEOUT):
return fmt.Errorf(p.ServerIdentity().String() + " didn't get the <finalResultMessage> on time")
}

Expand Down
10 changes: 5 additions & 5 deletions services/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ func (s *Service) ShufflingPhase(targetSurvey SurveyID) error {
var tmpShufflingResult []libunlynx.CipherVector
select {
case tmpShufflingResult = <-pi.(*protocolsunlynx.ShufflingProtocol).FeedbackChannel:
case <-time.After(libunlynx.DefaultTimeout):
case <-time.After(libunlynx.TIMEOUT):
return fmt.Errorf(s.ServerIdentity().String() + " didn't get the <tmpShufflingResult> on time")
}

Expand Down Expand Up @@ -762,7 +762,7 @@ func (s *Service) TaggingPhase(targetSurvey SurveyID) error {
var tmpDeterministicTaggingResult []libunlynx.DeterministCipherText
select {
case tmpDeterministicTaggingResult = <-pi.(*protocolsunlynx.DeterministicTaggingProtocol).FeedbackChannel:
case <-time.After(libunlynx.DefaultTimeout):
case <-time.After(libunlynx.TIMEOUT):
return fmt.Errorf(s.ServerIdentity().String() + " didn't get the <tmpDeterministicTaggingResult> on time")
}

Expand Down Expand Up @@ -801,7 +801,7 @@ func (s *Service) AggregationPhase(targetSurvey SurveyID) error {
var cothorityAggregatedData protocolsunlynx.CothorityAggregatedData
select {
case cothorityAggregatedData = <-pi.(*protocolsunlynx.CollectiveAggregationProtocol).FeedbackChannel:
case <-time.After(libunlynx.DefaultTimeout):
case <-time.After(libunlynx.TIMEOUT):
return fmt.Errorf(s.ServerIdentity().String() + " didn't get the <cothorityAggregatedData> on time")
}

Expand Down Expand Up @@ -830,7 +830,7 @@ func (s *Service) DROPhase(targetSurvey SurveyID) error {
var tmpShufflingResult []libunlynx.CipherVector
select {
case tmpShufflingResult = <-pi.(*protocolsunlynx.ShufflingProtocol).FeedbackChannel:
case <-time.After(libunlynx.DefaultTimeout):
case <-time.After(libunlynx.TIMEOUT):
return fmt.Errorf(s.ServerIdentity().String() + " didn't get the <tmpShufflingResult> on time")
}

Expand All @@ -856,7 +856,7 @@ func (s *Service) KeySwitchingPhase(targetSurvey SurveyID) error {
var tmpKeySwitchedAggregatedResponses libunlynx.CipherVector
select {
case tmpKeySwitchedAggregatedResponses = <-pi.(*protocolsunlynx.KeySwitchingProtocol).FeedbackChannel:
case <-time.After(libunlynx.DefaultTimeout):
case <-time.After(libunlynx.TIMEOUT):
return fmt.Errorf(s.ServerIdentity().String() + " didn't get the <tmpKeySwitchedAggregatedResponses> on time")
}

Expand Down
2 changes: 1 addition & 1 deletion simul/addrm_server_simul.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (sim *AddRmSimulation) Run(config *onet.SimulationConfig) error {
case results := <-root.ProtocolInstance().(*protocolsunlynxutils.AddRmServerProtocol).FeedbackChannel:
log.Lvl1("Number of aggregated lines: ", len(results))
libunlynx.EndTimer(round)
case <-time.After(libunlynx.DefaultTimeout):
case <-time.After(libunlynx.TIMEOUT):
return fmt.Errorf("simulation didn't finish in time")
}
}
Expand Down
2 changes: 1 addition & 1 deletion simul/local_aggregation_simul.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (sim *LocalAggregationSimulation) Run(config *onet.SimulationConfig) error
case results := <-root.ProtocolInstance().(*protocolsunlynxutils.LocalAggregationProtocol).FeedbackChannel:
log.Lvl1("Number of aggregated lines: ", len(results))
libunlynx.EndTimer(round)
case <-time.After(libunlynx.DefaultTimeout):
case <-time.After(libunlynx.TIMEOUT):
return fmt.Errorf("simulation didn't finish in time")
}
}
Expand Down
2 changes: 1 addition & 1 deletion simul/local_clear_aggregation_simul.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (sim *LocalClearAggregationSimulation) Run(config *onet.SimulationConfig) e
log.Lvl1("Result is wrong! :(")
}
round.Record()
case <-time.After(libunlynx.DefaultTimeout):
case <-time.After(libunlynx.TIMEOUT):
return fmt.Errorf("simulation didn't finish in time")
}
}
Expand Down
2 changes: 1 addition & 1 deletion simul/proofs_verification_simul.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func (sim *ProofsVerificationSimulation) Run(config *onet.SimulationConfig) erro
} else if results[5] == false {
return fmt.Errorf("collective aggregation proofs failed")
}
case <-time.After(libunlynx.DefaultTimeout):
case <-time.After(libunlynx.TIMEOUT):
return fmt.Errorf("simulation didn't finish in time")
}
}
Expand Down

0 comments on commit 8563eee

Please sign in to comment.