mirror of
https://github.com/JakeHillion/scx.git
synced 2024-11-26 19:30:24 +00:00
scx_stats: server: open_ops must be kept throughout a client session
open_ops tracks which ops have been opened by the client session; however, it was being created on each handle_request() making every request to open each time. Fix it by moving it to the caller.
This commit is contained in:
parent
25d7e6f787
commit
6cba8d786a
@ -221,9 +221,9 @@ where
|
||||
line: String,
|
||||
data: &Arc<Mutex<ScxStatsServerData<Req, Res>>>,
|
||||
ch: &ChannelPair<Req, Res>,
|
||||
open_ops: &mut ScxStatsOpenOps<Req, Res>,
|
||||
) -> Result<ScxStatsResponse> {
|
||||
let req: ScxStatsRequest = serde_json::from_str(&line)?;
|
||||
let mut open_ops = ScxStatsOpenOps::new();
|
||||
|
||||
match req.req.as_str() {
|
||||
"stats" => {
|
||||
@ -263,6 +263,7 @@ where
|
||||
exit: Arc<AtomicBool>,
|
||||
) -> Result<()> {
|
||||
let mut stream_reader = BufReader::new(stream.try_clone()?);
|
||||
let mut open_ops = ScxStatsOpenOps::new();
|
||||
|
||||
loop {
|
||||
let mut line = String::new();
|
||||
@ -275,7 +276,7 @@ where
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let resp = match Self::handle_request(line, &data, &inner_ch) {
|
||||
let resp = match Self::handle_request(line, &data, &inner_ch, &mut open_ops) {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
let errno = match e.downcast_ref::<ScxStatsErrno>() {
|
||||
|
Loading…
Reference in New Issue
Block a user