1
This commit is contained in:
parent
acb8e1a470
commit
09f31f0964
3
server/stat/src/constant.rs
Normal file
3
server/stat/src/constant.rs
Normal file
@ -0,0 +1,3 @@
|
||||
pub mod constant;
|
||||
|
||||
pub use constant::*;
|
1
server/stat/src/constant/constant.rs
Normal file
1
server/stat/src/constant/constant.rs
Normal file
@ -0,0 +1 @@
|
||||
pub const MAX_PACKET_LEN: usize = 1024 * 64;
|
@ -25,7 +25,7 @@ use actix_web::web::Bytes;
|
||||
use futures::FutureExt;
|
||||
use tokio::io::{AsyncReadExt, Interest};
|
||||
use crate::app::UserApp;
|
||||
use crate::{MAX_PACKET_LEN};
|
||||
use crate::constant;
|
||||
use tokio::net::TcpStream;
|
||||
use tokio::runtime::Runtime;
|
||||
use crate::app::user_app::DownStreamPack;
|
||||
@ -78,8 +78,8 @@ impl WsConn {
|
||||
}
|
||||
while true {
|
||||
let mut read_bytes = buf_len - already_read_bytes;
|
||||
if read_bytes > MAX_PACKET_LEN - self.recv_buf_len {
|
||||
read_bytes = MAX_PACKET_LEN - self.recv_buf_len;
|
||||
if read_bytes > constant::MAX_PACKET_LEN - self.recv_buf_len {
|
||||
read_bytes = constant::MAX_PACKET_LEN - self.recv_buf_len;
|
||||
}
|
||||
if read_bytes > 0 {
|
||||
self.recv_buf[self.recv_buf_len..bin.len()].copy_from_slice(&bin);
|
||||
|
@ -5,9 +5,9 @@ mod listener;
|
||||
mod upstream;
|
||||
mod downstream;
|
||||
mod ss;
|
||||
use crate::app::UserApp;
|
||||
mod constant;
|
||||
|
||||
const MAX_PACKET_LEN: usize = 1024 * 64;
|
||||
use crate::app::UserApp;
|
||||
|
||||
fn main() {
|
||||
App::init(UserApp::instance());
|
||||
|
Loading…
x
Reference in New Issue
Block a user