Преглед изворни кода

完全取消限制,改成异步发送。

skyfffire пре 1 година
родитељ
комит
e96ac5cd83
1 измењених фајлова са 7 додато и 3 уклоњено
  1. 7 3
      exchanges/src/socket_tool.rs

+ 7 - 3
exchanges/src/socket_tool.rs

@@ -10,6 +10,7 @@ use futures_util::stream::{SplitSink, SplitStream};
 use ring::hmac;
 use serde_json::json;
 use tokio::net::TcpStream;
+use tokio::spawn;
 use tokio::sync::Mutex;
 use tokio_tungstenite::{connect_async, MaybeTlsStream, WebSocketStream};
 use tokio_tungstenite::tungstenite::{Error, Message};
@@ -125,9 +126,12 @@ impl AbstractWsMode {
                                     //         read_tx.unbounded_send(data_c).unwrap();
                                     //     }
                                     // } else {
-                                        if read_tx.len() == 0 {
-                                            read_tx.unbounded_send(data_c).unwrap();
-                                        }
+                                    //     if read_tx.len() == 0 {
+                                    let r = read_tx.clone();
+                                    spawn(async move {
+                                        r.unbounded_send(data_c).unwrap();
+                                    });
+                                        // }
                                     // }
                                 }