fix logic error on loading peer
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Dan Ballard 2021-12-17 20:20:17 -05:00
parent 4c48fd603d
commit 4903e9376b
3 changed files with 23 additions and 20 deletions

4
go.mod
View File

@ -3,10 +3,10 @@ module git.openprivacy.ca/cwtch.im/libcwtch-go
go 1.15
require (
cwtch.im/cwtch v0.14.4
cwtch.im/cwtch v0.14.5
git.openprivacy.ca/cwtch.im/server v1.4.1
git.openprivacy.ca/openprivacy/connectivity v1.5.0
git.openprivacy.ca/openprivacy/log v1.0.3
github.com/mutecomm/go-sqlcipher/v4 v4.4.2
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf // indirect
)
)

2
go.sum
View File

@ -17,6 +17,8 @@ cwtch.im/cwtch v0.14.3 h1:CKNBYGfKErtLDY3fUOyadTVNbI2JjOe+Ud/srydVAko=
cwtch.im/cwtch v0.14.3/go.mod h1:/fLuoYLY/7JHw6RojFojpd245CiOcU24QpWqzh9FRDI=
cwtch.im/cwtch v0.14.4 h1:QbQVzrAqczAG5tGazQvRVfN7MyQPWVN5Fwv7MzCXZs4=
cwtch.im/cwtch v0.14.4/go.mod h1:/fLuoYLY/7JHw6RojFojpd245CiOcU24QpWqzh9FRDI=
cwtch.im/cwtch v0.14.5 h1:GY86C8UgqmuGh7ATR4C14hndc+c7PwPI8WH3l2iwnaQ=
cwtch.im/cwtch v0.14.5/go.mod h1:/fLuoYLY/7JHw6RojFojpd245CiOcU24QpWqzh9FRDI=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU=
filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=

View File

@ -94,26 +94,25 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
if e.Data[event.Created] == event.True {
profile.SetScopedZonedAttribute(attr.PublicScope, attr.ProfileZone, constants2.Picture, ImageToString(NewImage(RandomProfileImage(onion), TypeImageDistro)))
}
if e.Data[event.Created] == event.True {
profile.SetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants2.PeerOnline, event.False)
eh.app.AddPeerPlugin(onion, plugins.CONNECTIONRETRY)
eh.app.AddPeerPlugin(onion, plugins.NETWORKCHECK)
// If the user has chosen to block unknown profiles
// then explicitly configure the protocol engine to do so..
if ReadGlobalSettings().BlockUnknownConnections {
profile.BlockUnknownConnections()
} else {
// For completeness
profile.AllowUnknownConnections()
}
profile.SetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants2.PeerOnline, event.False)
eh.app.AddPeerPlugin(onion, plugins.CONNECTIONRETRY)
eh.app.AddPeerPlugin(onion, plugins.NETWORKCHECK)
// Start up the Profile
profile.Listen()
profile.StartPeersConnections()
if _, err := groups.ExperimentGate(ReadGlobalSettings().Experiments); err == nil {
profile.StartServerConnections()
}
// If the user has chosen to block unknown profiles
// then explicitly configure the protocol engine to do so..
if ReadGlobalSettings().BlockUnknownConnections {
profile.BlockUnknownConnections()
} else {
// For completeness
profile.AllowUnknownConnections()
}
// Start up the Profile
profile.Listen()
profile.StartPeersConnections()
if _, err := groups.ExperimentGate(ReadGlobalSettings().Experiments); err == nil {
profile.StartServerConnections()
}
online, _ := profile.GetScopedZonedAttribute(attr.LocalScope, attr.ProfileZone, constants2.PeerOnline)
@ -409,6 +408,8 @@ func (eh *EventHandler) startHandlingPeer(onion string) {
eventBus.Subscribe(event.SendMessageToPeerError, q)
eventBus.Subscribe(event.ServerStateChange, q)
eventBus.Subscribe(event.PeerStateChange, q)
eventBus.Subscribe(event.ChangePasswordSuccess, q)
eventBus.Subscribe(event.ChangePasswordError, q)
eventBus.Subscribe(event.NewRetValMessageFromPeer, q)
eventBus.Subscribe(event.ShareManifest, q)
eventBus.Subscribe(event.ManifestSizeReceived, q)