diff --git a/abci/examples/echo_socket.rs b/abci/examples/echo_socket.rs index 6538d277..604910ea 100644 --- a/abci/examples/echo_socket.rs +++ b/abci/examples/echo_socket.rs @@ -18,7 +18,7 @@ pub fn main() { let app = EchoApp {}; let cancel = CANCEL_TOKEN.clone(); - let mut server = ServerBuilder::new(app, &socket) + let server = ServerBuilder::new(app, &socket) .with_cancel_token(cancel) .build() .expect("server failed"); diff --git a/abci/src/application.rs b/abci/src/application.rs index 88490638..c16935f1 100644 --- a/abci/src/application.rs +++ b/abci/src/application.rs @@ -80,7 +80,7 @@ pub trait Application { /// Called when bootstrapping the node using state sync. fn offer_snapshot( - &mut self, + &self, _request: abci::RequestOfferSnapshot, ) -> Result { Ok(Default::default()) @@ -144,12 +144,12 @@ pub trait RequestDispatcher { /// /// `RequestDispatcher` can indicate that it will no longer process new /// requests by returning `None` variant. - fn handle(&mut self, request: abci::Request) -> Option; + fn handle(&self, request: abci::Request) -> Option; } // Implement `RequestDispatcher` for all `Application`s. impl RequestDispatcher for A { - fn handle(&mut self, request: abci::Request) -> Option { + fn handle(&self, request: abci::Request) -> Option { tracing::trace!(?request, "received request"); let response: Result = match request.value? { diff --git a/abci/src/server.rs b/abci/src/server.rs index 5d70e9ce..1ee09590 100644 --- a/abci/src/server.rs +++ b/abci/src/server.rs @@ -31,10 +31,10 @@ pub trait Server { /// however, errors must be examined and handled, as the connection /// should not terminate. One exception is [Error::Cancelled], which /// means server shutdown was requested. - fn next_client(&mut self) -> Result<(), Error>; + fn next_client(&self) -> Result<(), Error>; #[deprecated = "use `next_client()`"] - fn handle_connection(&mut self) -> Result<(), Error> { + fn handle_connection(&self) -> Result<(), Error> { self.next_client() } } @@ -56,7 +56,7 @@ pub trait Server { /// impl tenderdash_abci::Application for MyAbciApplication {}; /// let app = MyAbciApplication {}; /// let bind_address = "unix:///tmp/abci.sock"; -/// let mut server = tenderdash_abci::ServerBuilder::new(app, &bind_address).build().expect("server failed"); +/// let server = tenderdash_abci::ServerBuilder::new(app, &bind_address).build().expect("server failed"); /// loop { /// if let Err(tenderdash_abci::Error::Cancelled()) = server.next_client() { /// break; diff --git a/abci/src/server/generic.rs b/abci/src/server/generic.rs index 3dcea3ac..921486c7 100644 --- a/abci/src/server/generic.rs +++ b/abci/src/server/generic.rs @@ -98,7 +98,7 @@ where L::Addr: Send + Debug, L::Io: Send, { - fn next_client(&mut self) -> Result<(), Error> { + fn next_client(&self) -> Result<(), Error> { // we create child token to stop the codec but not kill the app let cancel_token = self.cancel.child_token(); let listener = Arc::clone(&self.listener); diff --git a/abci/tests/kvstore.rs b/abci/tests/kvstore.rs index 24f0e61e..febc96cf 100644 --- a/abci/tests/kvstore.rs +++ b/abci/tests/kvstore.rs @@ -55,7 +55,7 @@ fn test_kvstore() { let bind_address = format!("unix://{}", SOCKET); let cancel = CANCEL_TOKEN.clone(); - let mut server = ServerBuilder::new(abci_app, &bind_address) + let server = ServerBuilder::new(abci_app, &bind_address) .with_cancel_token(cancel) .build() .expect("server failed"); diff --git a/abci/tests/tcp.rs b/abci/tests/tcp.rs index e173b0f1..80b95dd6 100644 --- a/abci/tests/tcp.rs +++ b/abci/tests/tcp.rs @@ -50,7 +50,7 @@ fn tcp_server_test(test_name: &str, bind_address: &str) { let app = TestDispatcher {}; - let mut server = ServerBuilder::new(app, &bind_address) + let server = ServerBuilder::new(app, &bind_address) .build() .expect("server failed"); let socket_uri = bind_address.to_string(); @@ -72,7 +72,7 @@ fn tcp_server_test(test_name: &str, bind_address: &str) { pub struct TestDispatcher {} impl RequestDispatcher for TestDispatcher { - fn handle(&mut self, request: proto::abci::Request) -> Option { + fn handle(&self, request: proto::abci::Request) -> Option { // Assert that Info request will is received and close the connection assert!(matches!( request.value, diff --git a/abci/tests/unix.rs b/abci/tests/unix.rs index b26ba84a..36baa16d 100644 --- a/abci/tests/unix.rs +++ b/abci/tests/unix.rs @@ -29,7 +29,7 @@ fn test_unix_socket_server() { let app = TestDispatcher {}; - let mut server = ServerBuilder::new(app, &bind_address) + let server = ServerBuilder::new(app, &bind_address) .build() .expect("server failed"); @@ -53,7 +53,7 @@ fn test_unix_socket_server() { pub struct TestDispatcher {} impl RequestDispatcher for TestDispatcher { - fn handle(&mut self, request: proto::abci::Request) -> Option { + fn handle(&self, request: proto::abci::Request) -> Option { // Assert that Info request will is received and close the connection assert!(matches!( request.value,