refactor: update Socket.IO actix integration

This commit is contained in:
zhenyi 2026-05-30 15:07:31 +08:00
parent 3e07fedd0c
commit 79b03a90a7

View File

@ -92,9 +92,8 @@ async fn engine_post(
validate_sid(sid)?;
let session = io.session(sid).await.ok_or_else(|| ErrorNotFound("sid"))?;
if session.post_active.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed).is_err() {
io.remove_session(&session, DisconnectReason::TransportClosed)
.await;
return Err(ErrorBadRequest("overlapping post request"));
// Another POST is in progress — return error without destroying session
return Err(ErrorBadRequest("concurrent polling request"));
}
let _guard = ActiveGuard(session.post_active.clone());
@ -149,9 +148,8 @@ async fn polling_get(
validate_sid(sid)?;
let session = io.session(sid).await.ok_or_else(|| ErrorNotFound("sid"))?;
if session.get_active.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed).is_err() {
io.remove_session(&session, DisconnectReason::TransportClosed)
.await;
return Err(ErrorBadRequest("overlapping get request"));
// Another GET is in progress — return error without destroying session
return Err(ErrorBadRequest("concurrent polling request"));
}
let _guard = ActiveGuard(session.get_active.clone());