Skip to content

Commit

Permalink
v0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MXWXZ committed Nov 29, 2024
1 parent 085fe6d commit df172ee
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v0.3.1
## Bug fix
1. Fix several bugs about websocket router.

# v0.3.0
## Changes
1. New plugin system.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion skynet/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "skynet"
version = "0.3.0"
version = "0.3.1"
edition = "2021"
authors = ["MXWXZ <[email protected]>"]
description = "Service integration and management system, optimized for home-lab use."
Expand Down
17 changes: 15 additions & 2 deletions skynet/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use skynet_api::{
},
plugin::{self, Body, WSMessage},
request::{Request, Router, RouterType},
tracing::debug,
HyUuid, Result, Skynet,
};

Expand Down Expand Up @@ -142,7 +143,7 @@ pub async fn error_middleware(
}

let (req, rsp) = rsp.into_parts();
if !cli.verbose && !rsp.status().is_success() {
if !cli.verbose && (rsp.status().is_client_error() || rsp.status().is_server_error()) {
Ok(ServiceResponse::new(req, rsp.drop_body()).map_into_left_body())
} else {
Ok(ServiceResponse::new(req, rsp).map_into_right_body())
Expand Down Expand Up @@ -312,7 +313,19 @@ fn ws_handler(
_ = rx.recv() =>{
break;
},
Some(Ok(msg)) = stream.next() => {
msg = stream.next() => {
let msg = if let Some(msg) = msg {
msg
} else {
break;
};
let msg = match msg {
Ok(msg) => msg,
Err(e) => {
debug!(error = %e, "Websocket error");
continue;
}
};
match msg {
Message::Ping(bytes) => {
if session.pong(&bytes).await.is_err() {
Expand Down

0 comments on commit df172ee

Please sign in to comment.