Commit 6c51e353 authored by David Stainton's avatar David Stainton

Remove drop decoy traffic

parent a7b83f76
Pipeline #968 failed with stage
in 10 minutes and 51 seconds
......@@ -123,30 +123,6 @@ func (s *Session) sendLoopDecoy() error {
return s.doSend(msg)
}
func (s *Session) sendDropDecoy() error {
s.log.Info("sending drop decoy")
const loopService = "loop"
serviceDesc, err := s.GetService(loopService)
if err != nil {
return err
}
payload := [constants.UserForwardPayloadLength]byte{}
id := [cConstants.MessageIDLength]byte{}
_, err = io.ReadFull(rand.Reader, id[:])
if err != nil {
return err
}
msg := &Message{
ID: &id,
Recipient: serviceDesc.Name,
Provider: serviceDesc.Provider,
Payload: payload[:],
WithSURB: false,
IsDecoy: true,
}
return s.doSend(msg)
}
func (s *Session) composeMessage(recipient, provider string, message []byte, isBlocking bool) (*Message, error) {
s.log.Debug("SendMessage")
if len(message) > constants.UserForwardPayloadLength-4 {
......
......@@ -60,8 +60,6 @@ type Session struct {
// λP
pTimer *poisson.Fount
// λD
dTimer *poisson.Fount
// λL
lTimer *poisson.Fount
......
......@@ -66,17 +66,6 @@ func (s *Session) setTimers(doc *pki.Document) {
} else {
s.lTimer.SetPoisson(lDesc)
}
// λD
dDesc := &poisson.Descriptor{
Lambda: doc.LambdaD,
Max: doc.LambdaDMaxDelay,
}
if s.dTimer == nil {
s.dTimer = poisson.NewTimer(dDesc)
} else {
s.dTimer.SetPoisson(dDesc)
}
}
func (s *Session) connStatusChange(op opConnStatusChanged) bool {
......@@ -119,15 +108,12 @@ func (s *Session) maybeUpdateTimers(doc *pki.Document) {
func (s *Session) worker() {
s.pTimer.Start()
defer s.pTimer.Stop()
s.dTimer.Start()
defer s.dTimer.Stop()
s.lTimer.Start()
defer s.lTimer.Stop()
var isConnected bool
for {
var lambdaPFired bool
var lambdaDFired bool
var lambdaLFired bool
var qo workerOp
select {
......@@ -136,8 +122,6 @@ func (s *Session) worker() {
return
case <-s.pTimer.Timer.C:
lambdaPFired = true
case <-s.dTimer.Timer.C:
lambdaDFired = true
case <-s.lTimer.Timer.C:
lambdaLFired = true
case qo = <-s.opCh:
......@@ -148,14 +132,6 @@ func (s *Session) worker() {
s.sendFromQueueOrDecoy()
}
}
if lambdaDFired {
if isConnected && !s.cfg.Debug.DisableDecoyTraffic {
err := s.sendDropDecoy()
if err != nil {
s.log.Error(err.Error())
}
}
}
if lambdaLFired {
if isConnected && !s.cfg.Debug.DisableDecoyTraffic {
err := s.sendLoopDecoy()
......@@ -182,9 +158,6 @@ func (s *Session) worker() {
if lambdaPFired {
s.pTimer.Next()
}
if lambdaDFired {
s.dTimer.Next()
}
if lambdaLFired {
s.lTimer.Next()
}
......@@ -205,7 +178,7 @@ func (s *Session) sendFromQueueOrDecoy() {
}
} else {
if !s.cfg.Debug.DisableDecoyTraffic {
err = s.sendDropDecoy()
err = s.sendLoopDecoy()
if err != nil {
s.log.Warningf("Failed to send loop decoy traffic: %v", err)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment