Split server and client msgs in libbonknet
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
use std::io::{Error, ErrorKind};
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use futures::{StreamExt, SinkExt};
|
||||
use futures::{SinkExt, StreamExt};
|
||||
use tokio::net::TcpStream;
|
||||
use tokio_rustls::rustls::{ClientConfig, RootCertStore};
|
||||
use tokio_rustls::rustls::pki_types::{ServerName};
|
||||
use tokio_rustls::rustls::pki_types::ServerName;
|
||||
use tokio_rustls::TlsConnector;
|
||||
use tokio_util::codec::{Framed, LengthDelimitedCodec};
|
||||
use libbonknet::*;
|
||||
use libbonknet::clientmsg::*;
|
||||
use uuid::Uuid;
|
||||
use tracing::{info, error};
|
||||
use tracing::{error, info};
|
||||
|
||||
|
||||
async fn datastream(tlsconfig: ClientConfig, conn_id: Uuid) -> std::io::Result<()> {
|
||||
@@ -129,7 +130,8 @@ async fn main() -> std::io::Result<()> {
|
||||
None => panic!("None in the transport"),
|
||||
Some(item) => match item {
|
||||
Ok(buf) => {
|
||||
use ToClientResponse::*;
|
||||
use libbonknet::clientmsg::ToClientResponse;
|
||||
use libbonknet::clientmsg::ToClientResponse::*;
|
||||
let msg: ToClientResponse = rmp_serde::from_slice(&buf).unwrap();
|
||||
match msg {
|
||||
OkServerList { data } => info!("{}", data.join("\n")),
|
||||
@@ -151,7 +153,8 @@ async fn main() -> std::io::Result<()> {
|
||||
None => panic!("None in the transport"),
|
||||
Some(item) => match item {
|
||||
Ok(buf) => {
|
||||
use ToClientResponse::*;
|
||||
use libbonknet::clientmsg::ToClientResponse;
|
||||
use libbonknet::clientmsg::ToClientResponse::*;
|
||||
let msg: ToClientResponse = rmp_serde::from_slice(&buf).unwrap();
|
||||
match msg {
|
||||
OkRequest { conn_id } => {
|
||||
|
||||
Reference in New Issue
Block a user