mirror of
https://gitlab.com/fabinfra/fabaccess/sute.git
synced 2025-03-12 14:41:52 +01:00
Handshake!
This commit is contained in:
parent
f561cc7df1
commit
d46bdbbab5
@ -45,7 +45,7 @@ pub fn bootstrap(log: Logger, stream: TcpStream) -> (RpcSystem<Side>, API) {
|
||||
return (rpc, API::new(log, client));
|
||||
}
|
||||
|
||||
async fn handshake(log: &Logger, mut stream: &mut TcpStream) -> Result<(), io::Error> {
|
||||
pub async fn handshake(log: &Logger, mut stream: &mut TcpStream) -> Result<(), io::Error> {
|
||||
let host = "localhost";
|
||||
let program = format!("{}-{}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"));
|
||||
let version = (0u32,1u32);
|
||||
|
@ -9,7 +9,7 @@ use smol::net::AsyncToSocketAddrs;
|
||||
|
||||
use slog::Logger;
|
||||
|
||||
use crate::schema::{bootstrap, API, Authentication};
|
||||
use crate::schema::{handshake, bootstrap, API, Authentication};
|
||||
|
||||
pub struct Session {
|
||||
pub bootstrap: API,
|
||||
@ -19,7 +19,8 @@ pub struct Session {
|
||||
|
||||
impl Session {
|
||||
pub async fn connect<A: AsyncToSocketAddrs>(log: Logger, addr: A) -> Result<Session> {
|
||||
let stream = TcpStream::connect(addr).await?;
|
||||
let mut stream = TcpStream::connect(addr).await?;
|
||||
handshake(&log, &mut stream).await;
|
||||
let (rpc_system, api) = bootstrap(log, stream);
|
||||
|
||||
Ok(Session {
|
||||
|
Loading…
x
Reference in New Issue
Block a user