From 5e77cfe6055f6d5cec6fba4d6be6b45ee1d785ff Mon Sep 17 00:00:00 2001 From: Carson Farmer Date: Wed, 3 Jun 2020 14:21:31 -0700 Subject: [PATCH 1/2] feat(net): skip check for read key Signed-off-by: Carson Farmer --- net/net.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/net/net.go b/net/net.go index 0c042e0b..6025a403 100644 --- a/net/net.go +++ b/net/net.go @@ -271,15 +271,13 @@ func (n *net) AddThread(ctx context.Context, addr ma.Multiaddr, opts ...core.New }); err != nil { return } - if args.ThreadKey.CanRead() { - var linfo thread.LogInfo - linfo, err = createLog(n.host.ID(), args.LogKey) - if err != nil { - return - } - if err = n.store.AddLog(id, linfo); err != nil { - return - } + var linfo thread.LogInfo + linfo, err = createLog(n.host.ID(), args.LogKey) + if err != nil { + return + } + if err = n.store.AddLog(id, linfo); err != nil { + return } threadComp, err := ma.NewComponent(thread.Name, id.String()) From 3da8646acf9290870c7c3d77ca93df3dabe4aafc Mon Sep 17 00:00:00 2001 From: Carson Farmer Date: Wed, 3 Jun 2020 14:42:18 -0700 Subject: [PATCH 2/2] fix: add check for logkey OR read perm Signed-off-by: Carson Farmer --- net/net.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/net/net.go b/net/net.go index 6025a403..4d4b6430 100644 --- a/net/net.go +++ b/net/net.go @@ -271,13 +271,15 @@ func (n *net) AddThread(ctx context.Context, addr ma.Multiaddr, opts ...core.New }); err != nil { return } - var linfo thread.LogInfo - linfo, err = createLog(n.host.ID(), args.LogKey) - if err != nil { - return - } - if err = n.store.AddLog(id, linfo); err != nil { - return + if args.ThreadKey.CanRead() || args.LogKey != nil { + var linfo thread.LogInfo + linfo, err = createLog(n.host.ID(), args.LogKey) + if err != nil { + return + } + if err = n.store.AddLog(id, linfo); err != nil { + return + } } threadComp, err := ma.NewComponent(thread.Name, id.String())