Skip to content
Snippets Groups Projects
Commit c7215b05 authored by Benjamin Wenger's avatar Benjamin Wenger
Browse files

fix to conversations and inclusion of RNG in context

parent ec56d1a6
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@ package context
import (
"gitlab.com/elixxir/client/context/switchboard"
"gitlab.com/elixxir/client/storage"
"gitlab.com/elixxir/crypto/fastRNG"
)
type Context struct {
......@@ -12,4 +13,6 @@ type Context struct {
// this interface allows it to be mocked for easy testing without the
// loop
Manager NetworkManager
//generic RNG for client
Rng *fastRNG.StreamGenerator
}
\ No newline at end of file
......@@ -15,11 +15,11 @@ require (
github.com/spf13/jwalterweatherman v1.1.0
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.6.2
gitlab.com/elixxir/comms v0.0.0-20200903181126-c92d7a304999
gitlab.com/elixxir/comms v0.0.0-20200909214857-b106ce82d9e8
gitlab.com/elixxir/crypto v0.0.0-20200907171019-008a9d4aa264
gitlab.com/elixxir/ekv v0.1.1
gitlab.com/elixxir/primitives v0.0.0-20200907165319-16ed0124890b
gitlab.com/xx_network/comms v0.0.0-20200825213037-f58fa7c0a641
gitlab.com/xx_network/comms v0.0.0-20200909172255-8dd37d862d9e
gitlab.com/xx_network/crypto v0.0.0-20200812183430-c77a5281c686
gitlab.com/xx_network/primitives v0.0.0-20200812183720-516a65a4a9b2
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a
......
......@@ -177,6 +177,8 @@ gitlab.com/elixxir/comms v0.0.0-20200901233126-5b6d9c7088c7 h1:BQpz37TSl+ndWKPpA
gitlab.com/elixxir/comms v0.0.0-20200901233126-5b6d9c7088c7/go.mod h1:HW3Ige10aeJeyb2fcQ/YOBPiyzY/4jHau1Cj6/1WBHc=
gitlab.com/elixxir/comms v0.0.0-20200903181126-c92d7a304999 h1:fxrqseawjJ2q6Z3NZyYLKAqld1+ECsDkrgJdmIieivM=
gitlab.com/elixxir/comms v0.0.0-20200903181126-c92d7a304999/go.mod h1:HW3Ige10aeJeyb2fcQ/YOBPiyzY/4jHau1Cj6/1WBHc=
gitlab.com/elixxir/comms v0.0.0-20200909214857-b106ce82d9e8 h1:y+0aElewUD0ceZHvf96+s8oUZnfBMD9aflOBztMNlZ0=
gitlab.com/elixxir/comms v0.0.0-20200909214857-b106ce82d9e8/go.mod h1:ZMwe9xZbPY1s81CVvy51hh+96b/supA797uxXEJJqRE=
gitlab.com/elixxir/crypto v0.0.0-20200804182833-984246dea2c4 h1:28ftZDeYEko7xptCZzeFWS1Iam95dj46TWFVVlKmw6A=
gitlab.com/elixxir/crypto v0.0.0-20200804182833-984246dea2c4/go.mod h1:ucm9SFKJo+K0N2GwRRpaNr+tKXMIOVWzmyUD0SbOu2c=
gitlab.com/elixxir/crypto v0.0.0-20200805174804-bdf909f2a16d/go.mod h1:cu6uNoANVLV0J6HyTL6KqVtVyh9SHU1RjJhytYlsbVQ=
......@@ -231,6 +233,8 @@ gitlab.com/xx_network/comms v0.0.0-20200818182121-732dd75b1947 h1:g0k4nP0o/6qkh0
gitlab.com/xx_network/comms v0.0.0-20200818182121-732dd75b1947/go.mod h1:idLzPGYig57XE7xuU93OlIF9s6NgSJj7OArQvsd5DjY=
gitlab.com/xx_network/comms v0.0.0-20200825213037-f58fa7c0a641 h1:d48S6FLIUJa1RMm5E20P/kbM8upHmfVgoc9G4+TDjhk=
gitlab.com/xx_network/comms v0.0.0-20200825213037-f58fa7c0a641/go.mod h1:idLzPGYig57XE7xuU93OlIF9s6NgSJj7OArQvsd5DjY=
gitlab.com/xx_network/comms v0.0.0-20200909172255-8dd37d862d9e h1:TUHn4Mg1hYHT5mMmCjsh6p+joJK2zwoLgq2x3LC2LUk=
gitlab.com/xx_network/comms v0.0.0-20200909172255-8dd37d862d9e/go.mod h1:+jEkDQKoK51WLl2ZZuxfAZkz6YFbUQ+oZfH0dt2wIF0=
gitlab.com/xx_network/crypto v0.0.0-20200806202113-978fa1984bbf/go.mod h1:i0df/q6dDCBiscgD51fMoS2U2TBrm6LcyN822JmB5Tw=
gitlab.com/xx_network/crypto v0.0.0-20200806235322-ede3c15881ce h1:gypNBUl2guESEv4MDgH+miwYqR4jPoWM8dLt2Zs5gIs=
gitlab.com/xx_network/crypto v0.0.0-20200806235322-ede3c15881ce/go.mod h1:i0df/q6dDCBiscgD51fMoS2U2TBrm6LcyN822JmB5Tw=
......
......@@ -20,6 +20,8 @@ package network
import (
"gitlab.com/elixxir/client/context"
"gitlab.com/elixxir/client/context/stoppable"
"gitlab.com/elixxir/comms/network"
"time"
)
// GetUpdates polls the network for updates.
......@@ -37,13 +39,13 @@ func StartTrackNetwork(ctx *context.Context) stoppable.Stoppable {
// TrackNetwork polls the network to get updated on the state of nodes, the
// round status, and informs the client when messages can be retrieved.
func TrackNetwork(ctx *context.Context, quitCh <-chan struct{}) {
ticker := timer.NewTicker(ctx.GetTrackNetworkPeriod())
ticker := time.NewTicker(ctx.GetTrackNetworkPeriod())
done := false
for !done {
select {
case <-quitCh:
done = true
case <-ticker:
case <-ticker.C:
trackNetwork(ctx)
}
}
......
......@@ -77,6 +77,13 @@ func (c *Conversation) ProcessReceivedMessageID(mid uint32) uint64 {
}
high = c.numReceivedRevolutions
case 0:
if mid > c.lastReceivedID {
c.lastReceivedID = mid
if err := c.save(); err != nil {
jww.FATAL.Panicf("Failed to save after updating Last "+
"Received ID in a conversation: %s", err)
}
}
high = c.numReceivedRevolutions
case -1:
high = c.numReceivedRevolutions - 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment