mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-27 23:40:23 +00:00
TUN-8419: Add capnp safe transport
To help support temporary errors that can occur in the capnp rpc calls, a wrapper is introduced to inspect the error conditions and allow for retrying within a short window.
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/google/uuid"
|
||||
"zombiezen.com/go/capnproto2/rpc"
|
||||
|
||||
"github.com/cloudflare/cloudflared/tunnelrpc"
|
||||
"github.com/cloudflare/cloudflared/tunnelrpc/pogs"
|
||||
)
|
||||
|
||||
@@ -28,7 +29,7 @@ func NewSessionClient(ctx context.Context, stream io.ReadWriteCloser, requestTim
|
||||
if n != len(rpcStreamProtocolSignature) {
|
||||
return nil, fmt.Errorf("expect to write %d bytes for RPC stream protocol signature, wrote %d", len(rpcStreamProtocolSignature), n)
|
||||
}
|
||||
transport := rpc.StreamTransport(stream)
|
||||
transport := tunnelrpc.SafeTransport(stream)
|
||||
conn := rpc.NewConn(transport)
|
||||
return &SessionClient{
|
||||
client: pogs.NewSessionManager_PogsClient(conn.Bootstrap(ctx), conn),
|
||||
|
Reference in New Issue
Block a user