We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c3e8f61 commit 35237acCopy full SHA for 35237ac
sqlx-core/src/net/socket/mod.rs
@@ -196,6 +196,16 @@ pub async fn connect_tcp<Ws: WithSocket>(
196
// IPv6 addresses in URLs will be wrapped in brackets and the `url` crate doesn't trim those.
197
let host = host.trim_matches(&['[', ']'][..]);
198
199
+ #[cfg(feature = "_rt-tokio")]
200
+ if crate::rt::rt_tokio::available() {
201
+ use tokio::net::TcpStream;
202
+
203
+ let stream = TcpStream::connect((host, port)).await?;
204
+ stream.set_nodelay(true)?;
205
206
+ return Ok(with_socket.with_socket(stream).await);
207
+ }
208
209
let addresses = if let Ok(addr) = host.parse::<Ipv4Addr>() {
210
let addr = SocketAddrV4::new(addr, port);
211
vec![SocketAddr::V4(addr)].into_iter()
0 commit comments