refactor: update Socket.IO actix integration
This commit is contained in:
parent
3e07fedd0c
commit
79b03a90a7
@ -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());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user