make it no mut

This commit is contained in:
Yuwei B
2023-09-05 00:14:01 +10:00
committed by Dirkjan Ochtman
parent fe7bd363a7
commit 1df7537192
18 changed files with 39 additions and 38 deletions

View File

@@ -196,7 +196,7 @@ where
type Response = Pin<Box<dyn Stream<Item = Result<DnsResponse, E>> + Send>>;
type Error = E;
fn send<R: Into<DnsRequest>>(&mut self, _: R) -> Self::Response {
fn send<R: Into<DnsRequest>>(&self, _: R) -> Self::Response {
let mut messages = self.messages.lock().expect("failed to lock at messages");
println!("MockClientHandle::send message count: {}", messages.len());
@@ -247,7 +247,7 @@ pub fn error<E>(error: E) -> Result<DnsResponse, E> {
pub trait OnSend: Clone + Send + Sync + 'static {
fn on_send<E>(
&mut self,
&self,
response: Result<DnsResponse, E>,
) -> Pin<Box<dyn Future<Output = Result<DnsResponse, E>> + Send>>
where

View File

@@ -645,7 +645,7 @@ impl OnSendBarrier {
impl OnSend for OnSendBarrier {
fn on_send<E>(
&mut self,
&self,
response: Result<DnsResponse, E>,
) -> Pin<Box<dyn Future<Output = Result<DnsResponse, E>> + Send>>
where

View File

@@ -23,7 +23,7 @@ impl DnsHandle for TestClient {
type Response = Box<dyn Stream<Item = Result<DnsResponse, Self::Error>> + Send + Unpin>;
type Error = ResolveError;
fn send<R: Into<DnsRequest>>(&mut self, _: R) -> Self::Response {
fn send<R: Into<DnsRequest>>(&self, _: R) -> Self::Response {
let i = self.attempts.load(Ordering::SeqCst);
if i > self.retries || self.retries - i == 0 {