Skip to content

Commit

Permalink
BenchmarkPingPong: use net.Pipe()
Browse files Browse the repository at this point in the history
Which seems to fix #344. This indicates there's a bug in
transport.NewPipe(), but I kinda want to phase that out anyway, so...
  • Loading branch information
zenhack committed Nov 24, 2022
1 parent bf31894 commit 447444b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rpc/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ package rpc_test

import (
"context"
"net"
"testing"

"capnproto.org/go/capnp/v3"
"capnproto.org/go/capnp/v3/rpc"
testcp "capnproto.org/go/capnp/v3/rpc/internal/testcapnp"
"capnproto.org/go/capnp/v3/rpc/transport"
)

func BenchmarkPingPong(b *testing.B) {
p1, p2 := transport.NewPipe(1)
p1, p2 := net.Pipe()
srv := testcp.PingPong_ServerToClient(pingPongServer{})
conn1 := rpc.NewConn(rpc.NewTransport(p2), &rpc.Options{
conn1 := rpc.NewConn(rpc.NewStreamTransport(p2), &rpc.Options{
ErrorReporter: testErrorReporter{tb: b},
BootstrapClient: capnp.Client(srv),
})
Expand All @@ -23,7 +23,7 @@ func BenchmarkPingPong(b *testing.B) {
b.Error("conn1.Close:", err)
}
}()
conn2 := rpc.NewConn(rpc.NewTransport(p1), &rpc.Options{
conn2 := rpc.NewConn(rpc.NewStreamTransport(p1), &rpc.Options{
ErrorReporter: testErrorReporter{tb: b},
})
defer func() {
Expand Down

0 comments on commit 447444b

Please sign in to comment.