mirror of
https://github.com/OMGeeky/tarpc.git
synced 2026-01-06 11:34:39 +01:00
Expose framing config in serde_transport.
This commit is contained in:
@@ -8,6 +8,8 @@ use clap::{App, Arg};
|
||||
use std::{io, net::SocketAddr};
|
||||
use tarpc::{client, context};
|
||||
use tokio_serde::formats::Json;
|
||||
use tokio_util::codec::LengthDelimitedCodec;
|
||||
use tokio::net::TcpStream;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> io::Result<()> {
|
||||
@@ -43,7 +45,12 @@ async fn main() -> io::Result<()> {
|
||||
|
||||
let name = flags.value_of("name").unwrap().into();
|
||||
|
||||
let transport = tarpc::serde_transport::tcp::connect(server_addr, Json::default()).await?;
|
||||
let conn = TcpStream::connect(server_addr).await?;
|
||||
let transport = tarpc::serde_transport::new(
|
||||
LengthDelimitedCodec::builder().max_frame_length(4294967296).new_framed(conn),
|
||||
Json::default(),
|
||||
);
|
||||
|
||||
|
||||
// WorldClient is generated by the service attribute. It has a constructor `new` that takes a
|
||||
// config and any Transport as input.
|
||||
|
||||
Reference in New Issue
Block a user