mirror of
https://github.com/openai/codex.git
synced 2026-04-30 11:21:34 +03:00
Remove outer handler mutex from exec-server RPC base
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use crate::protocol::InitializeResponse;
|
||||
use crate::server::ExecServerHandler;
|
||||
|
||||
@@ -9,24 +7,22 @@ use super::ExecServerError;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(super) struct LocalBackend {
|
||||
handler: Arc<Mutex<ExecServerHandler>>,
|
||||
handler: Arc<ExecServerHandler>,
|
||||
}
|
||||
|
||||
impl LocalBackend {
|
||||
pub(super) fn new(handler: ExecServerHandler) -> Self {
|
||||
Self {
|
||||
handler: Arc::new(Mutex::new(handler)),
|
||||
handler: Arc::new(handler),
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) async fn shutdown(&self) {
|
||||
self.handler.lock().await.shutdown().await;
|
||||
self.handler.shutdown().await;
|
||||
}
|
||||
|
||||
pub(super) async fn initialize(&self) -> Result<InitializeResponse, ExecServerError> {
|
||||
self.handler
|
||||
.lock()
|
||||
.await
|
||||
.initialize()
|
||||
.map_err(|error| ExecServerError::Server {
|
||||
code: error.code,
|
||||
@@ -36,8 +32,6 @@ impl LocalBackend {
|
||||
|
||||
pub(super) async fn initialized(&self) -> Result<(), ExecServerError> {
|
||||
self.handler
|
||||
.lock()
|
||||
.await
|
||||
.initialized()
|
||||
.map_err(ExecServerError::Protocol)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user