fix: remove connectinfo usage
This commit is contained in:
parent
e935668b85
commit
e254bf62fc
@ -1,4 +1,4 @@
|
|||||||
use std::{fmt::Display, net::SocketAddr};
|
use std::fmt::Display;
|
||||||
|
|
||||||
use super::AppError;
|
use super::AppError;
|
||||||
use async_tungstenite::{
|
use async_tungstenite::{
|
||||||
@ -9,7 +9,7 @@ use async_tungstenite::{
|
|||||||
use axum::{
|
use axum::{
|
||||||
extract::{
|
extract::{
|
||||||
ws::{CloseFrame as AxumCloseFrame, Message as AxumMessage, WebSocket, WebSocketUpgrade},
|
ws::{CloseFrame as AxumCloseFrame, Message as AxumMessage, WebSocket, WebSocketUpgrade},
|
||||||
ConnectInfo, Path, Query, State,
|
Path, Query, State,
|
||||||
},
|
},
|
||||||
headers::UserAgent,
|
headers::UserAgent,
|
||||||
response::IntoResponse,
|
response::IntoResponse,
|
||||||
@ -261,7 +261,6 @@ async fn http(
|
|||||||
async fn metadata_ws(
|
async fn metadata_ws(
|
||||||
State(app): State<AppState>,
|
State(app): State<AppState>,
|
||||||
TypedHeader(user_agent): TypedHeader<UserAgent>,
|
TypedHeader(user_agent): TypedHeader<UserAgent>,
|
||||||
ConnectInfo(addr): ConnectInfo<SocketAddr>,
|
|
||||||
ws: WebSocketUpgrade,
|
ws: WebSocketUpgrade,
|
||||||
) -> Result<impl IntoResponse, AppError> {
|
) -> Result<impl IntoResponse, AppError> {
|
||||||
use async_tungstenite::tokio::connect_async;
|
use async_tungstenite::tokio::connect_async;
|
||||||
@ -276,14 +275,15 @@ async fn metadata_ws(
|
|||||||
.on_failed_upgrade({
|
.on_failed_upgrade({
|
||||||
let user_agent = user_agent.clone();
|
let user_agent = user_agent.clone();
|
||||||
move |error| {
|
move |error| {
|
||||||
let _entered = tracing::info_span!("metadata ws http", client_addr = %addr, client_user_agent = %user_agent).entered();
|
let _entered =
|
||||||
|
tracing::info_span!("metadata ws http", client_user_agent = %user_agent)
|
||||||
|
.entered();
|
||||||
tracing::error!("failed to upgrade to websocket for client: {error}");
|
tracing::error!("failed to upgrade to websocket for client: {error}");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.on_upgrade(move |socket| {
|
.on_upgrade(move |socket| {
|
||||||
let span = tracing::info_span!(
|
let span = tracing::info_span!(
|
||||||
"metadata ws",
|
"metadata ws",
|
||||||
client_addr = %addr,
|
|
||||||
client_user_agent = %user_agent
|
client_user_agent = %user_agent
|
||||||
);
|
);
|
||||||
handle_metadata_socket(ws_stream, socket, app).instrument(span)
|
handle_metadata_socket(ws_stream, socket, app).instrument(span)
|
||||||
|
Loading…
Reference in New Issue
Block a user