Skip to content
Snippets Groups Projects
Commit 651fa192 authored by Jake Taylor's avatar Jake Taylor
Browse files

Merge branch 'release' into XX-3273/SendPreferred

parents 55103996 ad3714b7
No related branches found
No related tags found
1 merge request!23Release
...@@ -435,15 +435,16 @@ func (c *Client) StopNetworkFollower(timeout time.Duration) error { ...@@ -435,15 +435,16 @@ func (c *Client) StopNetworkFollower(timeout time.Duration) error {
return errors.WithMessage(err, "Failed to Stop the Network Follower") return errors.WithMessage(err, "Failed to Stop the Network Follower")
} }
err = c.runner.Close(timeout) err = c.runner.Close(timeout)
if err != nil {
return errors.WithMessage(err, "Failed to Stop the Network Follower")
}
c.runner = stoppable.NewMulti("client") c.runner = stoppable.NewMulti("client")
err = c.status.toStopped() err2 := c.status.toStopped()
if err != nil { if err2 != nil {
return errors.WithMessage(err, "Failed to Stop the Network Follower") if err ==nil{
err = err2
}else{
err = errors.WithMessage(err,err2.Error())
} }
return nil }
return err
} }
// NetworkFollowerStatus Gets the state of the network follower. Returns: // NetworkFollowerStatus Gets the state of the network follower. Returns:
......
// Code generated by go generate; DO NOT EDIT. // Code generated by go generate; DO NOT EDIT.
// This file was generated by robots at // This file was generated by robots at
// 2021-05-05 15:53:47.443011 -0500 CDT m=+0.014473892 // 2021-05-07 09:33:37.4750421 -0700 PDT m=+0.043142701
package api package api
const GITVERSION = `b6f474ae fixed sendCmix time delay and the interface for bindings time now` const GITVERSION = `51fdae45 made stop network follower always allow restart`
const SEMVER = "2.4.0" const SEMVER = "2.5.0"
const DEPENDENCIES = `module gitlab.com/elixxir/client const DEPENDENCIES = `module gitlab.com/elixxir/client
go 1.13 go 1.13
...@@ -24,14 +24,15 @@ require ( ...@@ -24,14 +24,15 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 github.com/spf13/jwalterweatherman v1.1.0
github.com/spf13/viper v1.7.1 github.com/spf13/viper v1.7.1
gitlab.com/elixxir/bloomfilter v0.0.0-20200930191214-10e9ac31b228 gitlab.com/elixxir/bloomfilter v0.0.0-20200930191214-10e9ac31b228
gitlab.com/elixxir/comms v0.0.4-0.20210505205202-1d4c18a7fcb2 gitlab.com/elixxir/comms v0.0.4-0.20210506225017-37485f5ba063
gitlab.com/elixxir/crypto v0.0.7-0.20210504210535-3077ddf9984d gitlab.com/elixxir/crypto v0.0.7-0.20210506223047-3196e4301110
gitlab.com/elixxir/ekv v0.1.5 gitlab.com/elixxir/ekv v0.1.5
gitlab.com/elixxir/primitives v0.0.3-0.20210504210415-34cf31c2816e gitlab.com/elixxir/primitives v0.0.3-0.20210504210415-34cf31c2816e
gitlab.com/xx_network/comms v0.0.4-0.20210505205155-48daa8448ad7 gitlab.com/xx_network/comms v0.0.4-0.20210505205155-48daa8448ad7
gitlab.com/xx_network/crypto v0.0.5-0.20210504210244-9ddabbad25fd gitlab.com/xx_network/crypto v0.0.5-0.20210504210244-9ddabbad25fd
gitlab.com/xx_network/primitives v0.0.4-0.20210504205835-db68f11de78a gitlab.com/xx_network/primitives v0.0.4-0.20210504205835-db68f11de78a
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57 // indirect golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57 // indirect
google.golang.org/genproto v0.0.0-20210105202744-fe13368bc0e1 // indirect google.golang.org/genproto v0.0.0-20210105202744-fe13368bc0e1 // indirect
google.golang.org/grpc v1.34.0 // indirect google.golang.org/grpc v1.34.0 // indirect
......
...@@ -55,18 +55,21 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader, ...@@ -55,18 +55,21 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader,
//lookup if an ongoing request is occurring //lookup if an ongoing request is occurring
rqType, sr, _, err := storage.Auth().GetRequest(partner.ID) rqType, sr, _, err := storage.Auth().GetRequest(partner.ID)
if err != nil && !strings.Contains(err.Error(), auth.NoRequest){ if err == nil {
if rqType == auth.Receive { if rqType == auth.Receive {
return 0, errors.WithMessage(err, return 0, errors.Errorf("Cannot send a request after " +
"Cannot send a request after receiving a request") "receiving a request")
} else if rqType == auth.Sent { } else if rqType == auth.Sent {
resend = true resend = true
}else{ }else{
return 0, errors.Errorf("Cannot send a request after " +
" a stored request with unknown rqType: %d", rqType)
}
}else if !strings.Contains(err.Error(), auth.NoRequest){
return 0, errors.WithMessage(err, return 0, errors.WithMessage(err,
"Cannot send a request after receiving unknown error " + "Cannot send a request after receiving unknown error " +
"on requesting contact status") "on requesting contact status")
} }
}
grp := storage.E2e().GetGroup() grp := storage.E2e().GetGroup()
......
...@@ -18,7 +18,7 @@ import ( ...@@ -18,7 +18,7 @@ import (
) )
// Change this value to set the version for this build // Change this value to set the version for this build
const currentVersion = "2.4.0" const currentVersion = "2.5.0"
func Version() string { func Version() string {
out := fmt.Sprintf("Elixxir Client v%s -- %s\n\n", api.SEMVER, out := fmt.Sprintf("Elixxir Client v%s -- %s\n\n", api.SEMVER,
......
...@@ -17,8 +17,8 @@ require ( ...@@ -17,8 +17,8 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 github.com/spf13/jwalterweatherman v1.1.0
github.com/spf13/viper v1.7.1 github.com/spf13/viper v1.7.1
gitlab.com/elixxir/bloomfilter v0.0.0-20200930191214-10e9ac31b228 gitlab.com/elixxir/bloomfilter v0.0.0-20200930191214-10e9ac31b228
gitlab.com/elixxir/comms v0.0.4-0.20210506161214-6371db79ce6f gitlab.com/elixxir/comms v0.0.4-0.20210506225017-37485f5ba063
gitlab.com/elixxir/crypto v0.0.7-0.20210504210535-3077ddf9984d gitlab.com/elixxir/crypto v0.0.7-0.20210506223047-3196e4301110
gitlab.com/elixxir/ekv v0.1.5 gitlab.com/elixxir/ekv v0.1.5
gitlab.com/elixxir/primitives v0.0.3-0.20210504210415-34cf31c2816e gitlab.com/elixxir/primitives v0.0.3-0.20210504210415-34cf31c2816e
gitlab.com/xx_network/comms v0.0.4-0.20210505205155-48daa8448ad7 gitlab.com/xx_network/comms v0.0.4-0.20210505205155-48daa8448ad7
......
...@@ -257,12 +257,16 @@ gitlab.com/elixxir/comms v0.0.4-0.20210505205202-1d4c18a7fcb2 h1:8aL4V7FaKkDb5iP ...@@ -257,12 +257,16 @@ gitlab.com/elixxir/comms v0.0.4-0.20210505205202-1d4c18a7fcb2 h1:8aL4V7FaKkDb5iP
gitlab.com/elixxir/comms v0.0.4-0.20210505205202-1d4c18a7fcb2/go.mod h1:VN0fNE7GFMrkZwRGnqA7fNNRAXDA4CCP6su/FQQ68RI= gitlab.com/elixxir/comms v0.0.4-0.20210505205202-1d4c18a7fcb2/go.mod h1:VN0fNE7GFMrkZwRGnqA7fNNRAXDA4CCP6su/FQQ68RI=
gitlab.com/elixxir/comms v0.0.4-0.20210506161214-6371db79ce6f h1:0hvU+6Y+JGFnBu8ZSMk0ukNuYg+GAnVKD8Yo4VwSdao= gitlab.com/elixxir/comms v0.0.4-0.20210506161214-6371db79ce6f h1:0hvU+6Y+JGFnBu8ZSMk0ukNuYg+GAnVKD8Yo4VwSdao=
gitlab.com/elixxir/comms v0.0.4-0.20210506161214-6371db79ce6f/go.mod h1:7ff+A4Nom55mKiRW7qWsN7LDjGay4OZwiaaIVXZ4hdk= gitlab.com/elixxir/comms v0.0.4-0.20210506161214-6371db79ce6f/go.mod h1:7ff+A4Nom55mKiRW7qWsN7LDjGay4OZwiaaIVXZ4hdk=
gitlab.com/elixxir/comms v0.0.4-0.20210506225017-37485f5ba063 h1:9A2FT1IDzb9E0HaEEcRMAZEVRM4SMXpklYvS6owSyIk=
gitlab.com/elixxir/comms v0.0.4-0.20210506225017-37485f5ba063/go.mod h1:KHV+lNKhcsXoor1KQizUHhCuHugnquldrAR8UU5PNKU=
gitlab.com/elixxir/crypto v0.0.0-20200804182833-984246dea2c4 h1:28ftZDeYEko7xptCZzeFWS1Iam95dj46TWFVVlKmw6A= 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-20200804182833-984246dea2c4/go.mod h1:ucm9SFKJo+K0N2GwRRpaNr+tKXMIOVWzmyUD0SbOu2c=
gitlab.com/elixxir/crypto v0.0.3 h1:znCt/x2bL4y8czTPaaFkwzdgSgW3BJc/1+dxyf1jqVw= gitlab.com/elixxir/crypto v0.0.3 h1:znCt/x2bL4y8czTPaaFkwzdgSgW3BJc/1+dxyf1jqVw=
gitlab.com/elixxir/crypto v0.0.3/go.mod h1:ZNgBOblhYToR4m8tj4cMvJ9UsJAUKq+p0gCp07WQmhA= gitlab.com/elixxir/crypto v0.0.3/go.mod h1:ZNgBOblhYToR4m8tj4cMvJ9UsJAUKq+p0gCp07WQmhA=
gitlab.com/elixxir/crypto v0.0.7-0.20210504210535-3077ddf9984d h1:E16E+gM2jJosFc8YmT2ISGxcfBThG2KAgsAcQXtxSIc= gitlab.com/elixxir/crypto v0.0.7-0.20210504210535-3077ddf9984d h1:E16E+gM2jJosFc8YmT2ISGxcfBThG2KAgsAcQXtxSIc=
gitlab.com/elixxir/crypto v0.0.7-0.20210504210535-3077ddf9984d/go.mod h1:pbq80k+R7XXvjyWDqanD2eCJi1ClfESdKS0K8NndoLs= gitlab.com/elixxir/crypto v0.0.7-0.20210504210535-3077ddf9984d/go.mod h1:pbq80k+R7XXvjyWDqanD2eCJi1ClfESdKS0K8NndoLs=
gitlab.com/elixxir/crypto v0.0.7-0.20210506223047-3196e4301110 h1:4KWUbx1RI5TABBM2omWl5MLW16dwySglz895X2rhSFQ=
gitlab.com/elixxir/crypto v0.0.7-0.20210506223047-3196e4301110/go.mod h1:pbq80k+R7XXvjyWDqanD2eCJi1ClfESdKS0K8NndoLs=
gitlab.com/elixxir/ekv v0.1.5 h1:R8M1PA5zRU1HVnTyrtwybdABh7gUJSCvt1JZwUSeTzk= gitlab.com/elixxir/ekv v0.1.5 h1:R8M1PA5zRU1HVnTyrtwybdABh7gUJSCvt1JZwUSeTzk=
gitlab.com/elixxir/ekv v0.1.5/go.mod h1:e6WPUt97taFZe5PFLPb1Dupk7tqmDCTQu1kkstqJvw4= gitlab.com/elixxir/ekv v0.1.5/go.mod h1:e6WPUt97taFZe5PFLPb1Dupk7tqmDCTQu1kkstqJvw4=
gitlab.com/elixxir/primitives v0.0.0-20200731184040-494269b53b4d/go.mod h1:OQgUZq7SjnE0b+8+iIAT2eqQF+2IFHn73tOo+aV11mg= gitlab.com/elixxir/primitives v0.0.0-20200731184040-494269b53b4d/go.mod h1:OQgUZq7SjnE0b+8+iIAT2eqQF+2IFHn73tOo+aV11mg=
......
package interfaces
// this interface is used to allow the follower to to be stopped later if it
// fails
type Running interface{
IsRunning()bool
}
...@@ -46,7 +46,7 @@ type followNetworkComms interface { ...@@ -46,7 +46,7 @@ type followNetworkComms interface {
// followNetwork polls the network to get updated on the state of nodes, the // followNetwork polls the network to get updated on the state of nodes, the
// round status, and informs the client when messages can be retrieved. // round status, and informs the client when messages can be retrieved.
func (m *manager) followNetwork(report interfaces.ClientErrorReport, quitCh <-chan struct{}) { func (m *manager) followNetwork(report interfaces.ClientErrorReport, quitCh <-chan struct{}, isRunning interfaces.Running) {
ticker := time.NewTicker(m.param.TrackNetworkPeriod) ticker := time.NewTicker(m.param.TrackNetworkPeriod)
TrackTicker := time.NewTicker(debugTrackPeriod) TrackTicker := time.NewTicker(debugTrackPeriod)
rng := m.Rng.GetStream() rng := m.Rng.GetStream()
...@@ -58,17 +58,23 @@ func (m *manager) followNetwork(report interfaces.ClientErrorReport, quitCh <-ch ...@@ -58,17 +58,23 @@ func (m *manager) followNetwork(report interfaces.ClientErrorReport, quitCh <-ch
rng.Close() rng.Close()
done = true done = true
case <-ticker.C: case <-ticker.C:
m.follow(report, rng, m.Comms) m.follow(report, rng, m.Comms, isRunning)
case <-TrackTicker.C: case <-TrackTicker.C:
numPolls := atomic.SwapUint64(m.tracker, 0) numPolls := atomic.SwapUint64(m.tracker, 0)
jww.INFO.Printf("Polled the network %d times in the "+ jww.INFO.Printf("Polled the network %d times in the "+
"last %s", numPolls, debugTrackPeriod) "last %s", numPolls, debugTrackPeriod)
} }
if !isRunning.IsRunning(){
jww.ERROR.Printf("Killing network follower " +
"due to failed exit")
return
}
} }
} }
// executes each iteration of the follower // executes each iteration of the follower
func (m *manager) follow(report interfaces.ClientErrorReport, rng csprng.Source, comms followNetworkComms) { func (m *manager) follow(report interfaces.ClientErrorReport, rng csprng.Source,
comms followNetworkComms, isRunning interfaces.Running) {
//get the identity we will poll for //get the identity we will poll for
identity, err := m.Session.Reception().GetIdentity(rng) identity, err := m.Session.Reception().GetIdentity(rng)
...@@ -100,6 +106,11 @@ func (m *manager) follow(report interfaces.ClientErrorReport, rng csprng.Source, ...@@ -100,6 +106,11 @@ func (m *manager) follow(report interfaces.ClientErrorReport, rng csprng.Source,
identity.EndRequest, identity.EndRequest.Sub(identity.StartRequest), host.GetId()) identity.EndRequest, identity.EndRequest.Sub(identity.StartRequest), host.GetId())
return comms.SendPoll(host, &pollReq) return comms.SendPoll(host, &pollReq)
}) })
if !isRunning.IsRunning(){
jww.ERROR.Printf("Killing network follower " +
"due to failed exit")
return
}
if err != nil { if err != nil {
if report != nil { if report != nil {
report( report(
......
...@@ -130,7 +130,7 @@ func (m *manager) Follow(report interfaces.ClientErrorReport) (stoppable.Stoppab ...@@ -130,7 +130,7 @@ func (m *manager) Follow(report interfaces.ClientErrorReport) (stoppable.Stoppab
// Start the Network Tracker // Start the Network Tracker
trackNetworkStopper := stoppable.NewSingle("TrackNetwork") trackNetworkStopper := stoppable.NewSingle("TrackNetwork")
go m.followNetwork(report, trackNetworkStopper.Quit()) go m.followNetwork(report, trackNetworkStopper.Quit(), trackNetworkStopper)
multi.Add(trackNetworkStopper) multi.Add(trackNetworkStopper)
// Message reception // Message reception
......
...@@ -34,7 +34,7 @@ type sendCmixCommsInterface interface { ...@@ -34,7 +34,7 @@ type sendCmixCommsInterface interface {
} }
// 1.5 seconds // 1.5 seconds
const sendTimeBuffer = 1500 * time.Millisecond const sendTimeBuffer = 2500 * time.Millisecond
// WARNING: Potentially Unsafe // WARNING: Potentially Unsafe
// Public manager function to send a message over CMIX // Public manager function to send a message over CMIX
......
...@@ -82,7 +82,7 @@ func (m *Manager) SendUnsafe(msg message.Send, param params.Unsafe) ([]id.Round, ...@@ -82,7 +82,7 @@ func (m *Manager) SendUnsafe(msg message.Send, param params.Unsafe) ([]id.Round,
return nil, errors.Errorf("Failed to send %v/%v sub payloads:"+ return nil, errors.Errorf("Failed to send %v/%v sub payloads:"+
" %s", numFail, len(partitions), errRtn) " %s", numFail, len(partitions), errRtn)
} else { } else {
jww.INFO.Printf("Sucesfully Unsafe sent %d/%d to %s", jww.INFO.Printf("Successfully Unsafe sent %d/%d to %s",
len(partitions)-numFail, len(partitions), msg.Recipient) len(partitions)-numFail, len(partitions), msg.Recipient)
} }
......
...@@ -52,7 +52,6 @@ func (s *Single) Name() string { ...@@ -52,7 +52,6 @@ func (s *Single) Name() string {
func (s *Single) Close(timeout time.Duration) error { func (s *Single) Close(timeout time.Duration) error {
var err error var err error
s.once.Do(func() { s.once.Do(func() {
atomic.StoreUint32(&s.running, 0)
timer := time.NewTimer(timeout) timer := time.NewTimer(timeout)
select { select {
case <-timer.C: case <-timer.C:
...@@ -61,6 +60,7 @@ func (s *Single) Close(timeout time.Duration) error { ...@@ -61,6 +60,7 @@ func (s *Single) Close(timeout time.Duration) error {
err = errors.Errorf("%s failed to close", s.name) err = errors.Errorf("%s failed to close", s.name)
case s.quit <- struct{}{}: case s.quit <- struct{}{}:
} }
atomic.StoreUint32(&s.running, 0)
}) })
return err return err
} }
...@@ -21,6 +21,7 @@ const ( ...@@ -21,6 +21,7 @@ const (
const ( const (
bsBuffLengthErr = "length of buffer %d != %d expected" bsBuffLengthErr = "length of buffer %d != %d expected"
bsKvSaveErr = "failed to save blockStore to KV: %+v" bsKvSaveErr = "failed to save blockStore to KV: %+v"
bsKvInitSaveErr = "failed to save initial block: %+v"
bsKvLoadErr = "failed to get BlockStore from storage: %+v" bsKvLoadErr = "failed to get BlockStore from storage: %+v"
bsKvUnmarshalErr = "failed to unmarshal BlockStore loaded from storage: %+v" bsKvUnmarshalErr = "failed to unmarshal BlockStore loaded from storage: %+v"
bJsonMarshalErr = "failed to JSON marshal block %d: %+v" bJsonMarshalErr = "failed to JSON marshal block %d: %+v"
...@@ -218,6 +219,12 @@ func (bs *BlockStore) save() error { ...@@ -218,6 +219,12 @@ func (bs *BlockStore) save() error {
return errors.Errorf(bsKvSaveErr, err) return errors.Errorf(bsKvSaveErr, err)
} }
// Save initial block
err = bs.saveBlock()
if err != nil {
return errors.Errorf(bsKvInitSaveErr, err)
}
return nil return nil
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment