Browse Source

Updating libricochet to latest

update-libricochet
Sarah Jamie Lewis 10 months ago
parent
commit
9e055f1ee0
6 changed files with 16 additions and 16 deletions
  1. 1
    1
      go.mod
  2. 2
    2
      go.sum
  3. 5
    5
      protocol/connections/engine.go
  4. 4
    4
      server/server.go
  5. 3
    3
      server/server_instance.go
  6. 1
    1
      server/server_instance_test.go

+ 1
- 1
go.mod View File

@@ -1,7 +1,7 @@
module cwtch.im/cwtch

require (
git.openprivacy.ca/openprivacy/libricochet-go v0.0.0-20190121203021-e068de0ef857
git.openprivacy.ca/openprivacy/libricochet-go v0.0.0-20190123194730-b2f6b314fc5c
github.com/c-bata/go-prompt v0.2.3
github.com/golang/protobuf v1.2.0
github.com/mattn/go-colorable v0.0.9 // indirect

+ 2
- 2
go.sum View File

@@ -1,5 +1,5 @@
git.openprivacy.ca/openprivacy/libricochet-go v0.0.0-20190121203021-e068de0ef857 h1:Nigo3CR96RG8+I2Prl5JD0M1lVUAafIF1aqKhWd8wWU=
git.openprivacy.ca/openprivacy/libricochet-go v0.0.0-20190121203021-e068de0ef857/go.mod h1:ym2A8NFOWi63Vn+IdYWtZrGhOr9zqGCIxA7i4ZsjQL8=
git.openprivacy.ca/openprivacy/libricochet-go v0.0.0-20190123194730-b2f6b314fc5c h1:kzgZrgoURJ07ARliL+W91jjI0x03UkE6cZG1gb5aPjY=
git.openprivacy.ca/openprivacy/libricochet-go v0.0.0-20190123194730-b2f6b314fc5c/go.mod h1:ym2A8NFOWi63Vn+IdYWtZrGhOr9zqGCIxA7i4ZsjQL8=
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 h1:w1UutsfOrms1J05zt7ISrnJIXKzwaspym5BTKGx93EI=
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0=
github.com/c-bata/go-prompt v0.2.3 h1:jjCS+QhG/sULBhAaBdjb2PlMRVaKXQgn+4yzaauvs2s=

+ 5
- 5
protocol/connections/engine.go View File

@@ -119,9 +119,9 @@ func (e *Engine) listenFn() {
return
}

af := application.ApplicationInstanceFactory{}
af := application.InstanceFactory{}
af.Init()
af.AddHandler("im.cwtch.peer", func(rai *application.ApplicationInstance) func() channels.Handler {
af.AddHandler("im.cwtch.peer", func(rai *application.Instance) func() channels.Handler {
cpi := new(CwtchPeerInstance)
cpi.Init(rai, ra)
return func() channels.Handler {
@@ -131,7 +131,7 @@ func (e *Engine) listenFn() {
}
})

af.AddHandler("im.cwtch.peer.data", func(rai *application.ApplicationInstance) func() channels.Handler {
af.AddHandler("im.cwtch.peer.data", func(rai *application.Instance) func() channels.Handler {
cpi := new(CwtchPeerInstance)
cpi.Init(rai, ra)
return func() channels.Handler {
@@ -237,12 +237,12 @@ func (e *Engine) GetServers() map[string]ConnectionState {

// CwtchPeerInstance encapsulates incoming peer connections
type CwtchPeerInstance struct {
rai *application.ApplicationInstance
rai *application.Instance
ra *application.RicochetApplication
}

// Init sets up a CwtchPeerInstance
func (cpi *CwtchPeerInstance) Init(rai *application.ApplicationInstance, ra *application.RicochetApplication) {
func (cpi *CwtchPeerInstance) Init(rai *application.Instance, ra *application.RicochetApplication) {
cpi.rai = rai
cpi.ra = ra
}

+ 4
- 4
server/server.go View File

@@ -33,7 +33,7 @@ func (s *Server) Run(acn connectivity.ACN, serverConfig Config) {
cwtchserver := new(application.RicochetApplication)
s.metricsPack.Start(cwtchserver, serverConfig.ConfigDir, s.config.ServerReporting.LogMetricsToFile)

af := application.ApplicationInstanceFactory{}
af := application.InstanceFactory{}
af.Init()
ms := new(storage.MessageStore)
err := ms.Init(serverConfig.ConfigDir, s.config.MaxBufferLines, s.metricsPack.MessageCounter)
@@ -42,14 +42,14 @@ func (s *Server) Run(acn connectivity.ACN, serverConfig Config) {
acn.Close()
os.Exit(1)
}
af.AddHandler("im.cwtch.server.listen", func(rai *application.ApplicationInstance) func() channels.Handler {
af.AddHandler("im.cwtch.server.listen", func(rai *application.Instance) func() channels.Handler {
return func() channels.Handler {
cslc := new(listen.CwtchServerListenChannel)
return cslc
}
})

af.AddHandler("im.cwtch.server.fetch", func(rai *application.ApplicationInstance) func() channels.Handler {
af.AddHandler("im.cwtch.server.fetch", func(rai *application.Instance) func() channels.Handler {
si := new(Instance)
si.Init(rai, cwtchserver, ms)
return func() channels.Handler {
@@ -59,7 +59,7 @@ func (s *Server) Run(acn connectivity.ACN, serverConfig Config) {
}
})

af.AddHandler("im.cwtch.server.send", func(rai *application.ApplicationInstance) func() channels.Handler {
af.AddHandler("im.cwtch.server.send", func(rai *application.Instance) func() channels.Handler {
si := new(Instance)
si.Init(rai, cwtchserver, ms)
return func() channels.Handler {

+ 3
- 3
server/server_instance.go View File

@@ -10,13 +10,13 @@ import (

// Instance encapsulates the Ricochet application.
type Instance struct {
rai *application.ApplicationInstance
rai *application.Instance
ra *application.RicochetApplication
msi storage.MessageStoreInterface
}

// Init sets up a Server Instance
func (si *Instance) Init(rai *application.ApplicationInstance, ra *application.RicochetApplication, msi storage.MessageStoreInterface) {
func (si *Instance) Init(rai *application.Instance, ra *application.RicochetApplication, msi storage.MessageStoreInterface) {
si.rai = rai
si.ra = ra
si.msi = msi
@@ -30,7 +30,7 @@ func (si *Instance) HandleFetchRequest() []*protocol.GroupMessage {
// HandleGroupMessage takes in a group message and distributes it to all listening peers
func (si *Instance) HandleGroupMessage(gm *protocol.GroupMessage) {
si.msi.AddMessage(*gm)
go si.ra.Broadcast(func(rai *application.ApplicationInstance) {
go si.ra.Broadcast(func(rai *application.Instance) {
rai.Connection.Do(func() error {
channel := rai.Connection.Channel("im.cwtch.server.listen", channels.Inbound)
if channel != nil {

+ 1
- 1
server/server_instance_test.go View File

@@ -12,7 +12,7 @@ import (

func TestServerInstance(t *testing.T) {
si := new(Instance)
ai := new(application.ApplicationInstance)
ai := new(application.Instance)
ra := new(application.RicochetApplication)
msi := new(storage.MessageStore)
os.RemoveAll("messages")

Loading…
Cancel
Save