Cesar Rodas hace 10 meses
padre
commit
799a40df8c
Se han modificado 2 ficheros con 6 adiciones y 3 borrados
  1. 1 1
      crates/client/src/error.rs
  2. 5 2
      crates/client/src/relayer.rs

+ 1 - 1
crates/client/src/error.rs

@@ -16,7 +16,7 @@ pub enum Error {
 
     /// Internal error using the Sync channels
     #[error("Sync: {0}")]
-    Sync(#[from] SendError<Request>),
+    Sync(#[from] Box<SendError<Request>>),
 
     /// The client has no connection to any relayer
     #[error("There is no connection")]

+ 5 - 2
crates/client/src/relayer.rs

@@ -156,7 +156,7 @@ impl Relayer {
                             let msg: Result<Response, _> = serde_json::from_str(&msg);
 
                             if let Ok(msg) = msg {
-                                if let Err(error) = broadcast_to_listeners.try_send((Event::Response(msg), url.to_owned())) {
+                                if let Err(error) = broadcast_to_listeners.try_send((Event::Response(msg.into()), url.to_owned())) {
                                     log::error!("{}: Reconnecting client because of {}", url, error);
                                     break;
                                 }
@@ -197,7 +197,10 @@ impl Relayer {
 
     /// Sends a requests to this relayer
     pub async fn send(&self, request: Request) -> Result<(), Error> {
-        Ok(self.send_to_socket.send(request).await?)
+        self.send_to_socket
+            .send(request)
+            .await
+            .map_err(|e| Error::Sync(Box::new(e)))
     }
 
     /// Stops the background thread that has the connection to this relayer