Skip to content

Commit

Permalink
feat: enable back directchannel
Browse files Browse the repository at this point in the history
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
  • Loading branch information
gfanton committed Apr 29, 2021
1 parent 715269e commit f3e5098
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion go/pkg/bertyprotocol/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"berty.tech/berty/v2/go/pkg/protocoltypes"
"berty.tech/go-orbit-db/baseorbitdb"
"berty.tech/go-orbit-db/iface"
"berty.tech/go-orbit-db/pubsub/directchannel"
)

var _ Service = (*service)(nil)
Expand Down Expand Up @@ -128,7 +129,6 @@ func (opts *Opts) applyDefaults(ctx context.Context) error {
if opts.DatastoreDir != InMemoryDirectory {
orbitDirectory = filepath.Join(opts.DatastoreDir, NamespaceOrbitDBDirectory)
}

odbOpts := &NewOrbitDBOptions{
NewOrbitDBOptions: baseorbitdb.NewOrbitDBOptions{
Directory: &orbitDirectory,
Expand All @@ -138,6 +138,10 @@ func (opts *Opts) applyDefaults(ctx context.Context) error {
DeviceKeystore: opts.DeviceKeystore,
}

if opts.Host != nil {
odbOpts.NewOrbitDBOptions.DirectChannelFactory = directchannel.InitDirectChannelFactory(opts.Host)
}

odb, err := NewBertyOrbitDB(ctx, opts.IpfsCoreAPI, odbOpts)
if err != nil {
return err
Expand Down

0 comments on commit f3e5098

Please sign in to comment.