Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Commit

Permalink
Fix bugs in P2P demos
Browse files Browse the repository at this point in the history
  • Loading branch information
neilalexander committed Jun 25, 2021
1 parent bd7b0b1 commit a6f7e83
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 9 additions & 3 deletions cmd/dendrite-demo-pinecone/conn/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func ConnectToPeer(pRouter *pineconeRouter.Router, peer string) error {
ctx := context.Background()
c, _, err := websocket.Dial(ctx, peer, nil)
if err != nil {
return fmt.Errorf("websocket.Dial: %w", err)
return fmt.Errorf("websocket.DefaultDialer.Dial: %w", err)
}
parent = websocket.NetConn(ctx, c, websocket.MessageBinary)
} else {
Expand All @@ -43,7 +43,7 @@ type RoundTripper struct {
}

func (y *RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
req.URL.Scheme = "https"
req.URL.Scheme = "http"
return y.inner.RoundTrip(req)
}

Expand All @@ -57,7 +57,13 @@ func createTransport(s *pineconeSessions.Sessions) *http.Transport {
}
tr.RegisterProtocol(
"matrix", &RoundTripper{
inner: tr,
inner: &http.Transport{
DisableKeepAlives: false,
Dial: s.Dial,
DialContext: s.DialContext,
DialTLS: s.DialTLS,
DialTLSContext: s.DialTLSContext,
},
},
)
return tr
Expand Down
3 changes: 2 additions & 1 deletion cmd/dendritejs-pinecone/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package main

import (
"crypto/ed25519"
"encoding/hex"
"fmt"
"log"
"os"
Expand Down Expand Up @@ -166,7 +167,7 @@ func main() {
cfg.Global.TrustedIDServers = []string{}
cfg.Global.KeyID = gomatrixserverlib.KeyID(signing.KeyID)
cfg.Global.PrivateKey = sk
cfg.Global.ServerName = gomatrixserverlib.ServerName(pk)
cfg.Global.ServerName = gomatrixserverlib.ServerName(hex.EncodeToString(pk))

if err := cfg.Derive(); err != nil {
logrus.Fatalf("Failed to derive values from config: %s", err)
Expand Down

0 comments on commit a6f7e83

Please sign in to comment.