Skip to content

Commit

Permalink
#6 Passes integration_test.go. Shows benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
XioZ committed May 11, 2024
1 parent 04d97e0 commit 6475d7d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions mino/minows/mod.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func (m *minows) CreateRPC(name string, h mino.Handler, f serde.Factory) (mino.R
logger: m.logger.With().Str("rpc", uri).Logger(),
myAddr: m.myAddr,
uri: uri,
host: m.host,
handler: h,
mino: m,
factory: f,
Expand Down
6 changes: 4 additions & 2 deletions mino/minows/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"errors"
"github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/peerstore"
Expand Down Expand Up @@ -31,6 +32,7 @@ type rpc struct {

myAddr address
uri string
host host.Host
handler mino.Handler
mino *minows
factory serde.Factory
Expand Down Expand Up @@ -143,7 +145,7 @@ func (r rpc) Stream(ctx context.Context, players mino.Players) (mino.Sender, min

func (r rpc) addPeers(addrs []address) {
for _, addr := range addrs {
r.mino.host.Peerstore().AddAddr(addr.identity, addr.location,
r.host.Peerstore().AddAddr(addr.identity, addr.location,
peerstore.PermanentAddrTTL)
}
}
Expand Down Expand Up @@ -172,7 +174,7 @@ func (r rpc) unicast(ctx context.Context, dest address, req serde.Message) (
func (r rpc) openStream(ctx context.Context, dest address,
path string) (network.Stream, error) {
pid := protocol.ID(r.uri + path)
stream, err := r.mino.host.NewStream(ctx, dest.identity, pid)
stream, err := r.host.NewStream(ctx, dest.identity, pid)
if err != nil {
return nil, xerrors.Errorf("could not open stream: %v", err)
}
Expand Down

0 comments on commit 6475d7d

Please sign in to comment.