Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

threads: force connect when adding thread #109

Merged
merged 1 commit into from
Nov 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
threads: explicit connect to peer thread addr
Signed-off-by: jsign <[email protected]>
  • Loading branch information
jsign committed Nov 20, 2019
commit 6db9d392c142ba324333e67a713591e087296980
3 changes: 0 additions & 3 deletions eventstore/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
ds "github.com/ipfs/go-datastore"
"github.com/multiformats/go-multiaddr"
core "github.com/textileio/go-textile-core/store"
"github.com/textileio/go-textile-threads/util"
)

func TestE2EWithThreads(t *testing.T) {
Expand All @@ -21,7 +20,6 @@ func TestE2EWithThreads(t *testing.T) {
defer os.RemoveAll(tmpDir1)
ts1, err := DefaultThreadservice(tmpDir1, ProxyPort(0))
checkErr(t, err)
ts1.Bootstrap(util.DefaultBoostrapPeers())
defer ts1.Close()

s1, err := NewStore(ts1, WithRepoPath(tmpDir1))
Expand Down Expand Up @@ -55,7 +53,6 @@ func TestE2EWithThreads(t *testing.T) {
defer os.RemoveAll(tmpDir2)
ts2, err := DefaultThreadservice(tmpDir2, ProxyPort(0))
checkErr(t, err)
ts2.Bootstrap(util.DefaultBoostrapPeers())
defer ts2.Close()

s2, err := NewStore(ts2, WithRepoPath(tmpDir2))
Expand Down
12 changes: 12 additions & 0 deletions threads.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,18 @@ func (t *threads) AddThread(
return
}

threadMultiaddr, err := ma.NewComponent("thread", idstr)
if err != nil {
return
}
peerAddr := addr.Decapsulate(threadMultiaddr)
addri, err := peer.AddrInfoFromP2pAddr(peerAddr)
if err != nil {
return
}
if err = t.Host().Connect(ctx, *addri); err != nil {
return
}
lgs, err := t.service.getLogs(ctx, id, pid)
if err != nil {
return
Expand Down