From a7f2845a6a97af0c1855eb3c8d81cb4ca348d176 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 24 May 2021 13:12:05 +0100 Subject: [PATCH] Demo tweaks --- build/gobind-pinecone/monolith.go | 2 +- cmd/dendrite-demo-pinecone/conn/client.go | 14 ++------------ go.mod | 2 +- go.sum | 2 ++ 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/build/gobind-pinecone/monolith.go b/build/gobind-pinecone/monolith.go index c99ed0b01..0c26944fc 100644 --- a/build/gobind-pinecone/monolith.go +++ b/build/gobind-pinecone/monolith.go @@ -97,7 +97,7 @@ func (m *DendriteMonolith) SetStaticPeer(uri string) { m.staticPeerMutex.Unlock() m.DisconnectType(pineconeRouter.PeerTypeRemote) if uri != "" { - m.staticPeerConnect() + go m.staticPeerConnect() } } diff --git a/cmd/dendrite-demo-pinecone/conn/client.go b/cmd/dendrite-demo-pinecone/conn/client.go index 954564d40..66f9ebfaa 100644 --- a/cmd/dendrite-demo-pinecone/conn/client.go +++ b/cmd/dendrite-demo-pinecone/conn/client.go @@ -5,7 +5,6 @@ import ( "net" "net/http" "strings" - "time" "github.com/gorilla/websocket" "github.com/matrix-org/dendrite/setup" @@ -17,24 +16,15 @@ import ( func ConnectToPeer(pRouter *pineconeRouter.Router, peer string) error { var parent net.Conn - dialer := net.Dialer{ - Timeout: time.Second * 5, - KeepAlive: time.Second * 5, - } if strings.HasPrefix(peer, "ws://") || strings.HasPrefix(peer, "wss://") { - wsdialer := websocket.Dialer{ - NetDial: dialer.Dial, - NetDialContext: dialer.DialContext, - HandshakeTimeout: time.Second * 5, - } - c, _, err := wsdialer.Dial(peer, nil) + c, _, err := websocket.DefaultDialer.Dial(peer, nil) if err != nil { return fmt.Errorf("websocket.DefaultDialer.Dial: %w", err) } parent = WrapWebSocketConn(c) } else { var err error - parent, err = dialer.Dial("tcp", peer) + parent, err = net.Dial("tcp", peer) if err != nil { return fmt.Errorf("net.Dial: %w", err) } diff --git a/go.mod b/go.mod index f41fdc39a..70f99b82d 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/matrix-org/gomatrix v0.0.0-20200827122206-7dd5e2a05bcd github.com/matrix-org/gomatrixserverlib v0.0.0-20210302161955-6142fe3f8c2c github.com/matrix-org/naffka v0.0.0-20201009174903-d26a3b9cb161 - github.com/matrix-org/pinecone v0.0.0-20210524095705-54dc83854438 + github.com/matrix-org/pinecone v0.0.0-20210524121048-a698ff38c7c3 github.com/matrix-org/util v0.0.0-20200807132607-55161520e1d4 github.com/mattn/go-sqlite3 v1.14.7-0.20210414154423-1157a4212dcb github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 diff --git a/go.sum b/go.sum index e7dbe0cb4..9ce18c5ec 100644 --- a/go.sum +++ b/go.sum @@ -714,6 +714,8 @@ github.com/matrix-org/pinecone v0.0.0-20210518151943-2556e2cf7820 h1:OflgibJOmt1 github.com/matrix-org/pinecone v0.0.0-20210518151943-2556e2cf7820/go.mod h1:UQzJS6UVyVwfkr+RLrdvBB1vLyECqe3fLYNcbRxv8SA= github.com/matrix-org/pinecone v0.0.0-20210524095705-54dc83854438 h1:pfYBf8db9X8fsieJOUZqv6Evz6YByP+n9rOTzTPC66U= github.com/matrix-org/pinecone v0.0.0-20210524095705-54dc83854438/go.mod h1:UQzJS6UVyVwfkr+RLrdvBB1vLyECqe3fLYNcbRxv8SA= +github.com/matrix-org/pinecone v0.0.0-20210524121048-a698ff38c7c3 h1:uHQiX47DfRK8TSbrTgT3325RSghCVK0y+JPuRuvvIR4= +github.com/matrix-org/pinecone v0.0.0-20210524121048-a698ff38c7c3/go.mod h1:UQzJS6UVyVwfkr+RLrdvBB1vLyECqe3fLYNcbRxv8SA= github.com/matrix-org/util v0.0.0-20190711121626-527ce5ddefc7/go.mod h1:vVQlW/emklohkZnOPwD3LrZUBqdfsbiyO3p1lNV8F6U= github.com/matrix-org/util v0.0.0-20200807132607-55161520e1d4 h1:eCEHXWDv9Rm335MSuB49mFUK44bwZPFSDde3ORE3syk= github.com/matrix-org/util v0.0.0-20200807132607-55161520e1d4/go.mod h1:vVQlW/emklohkZnOPwD3LrZUBqdfsbiyO3p1lNV8F6U=