File tree 4 files changed +11
-3
lines changed
4 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 34
34
config. port ,
35
35
config. connect_timeout ,
36
36
config. tcp_user_timeout ,
37
+ #[ cfg( not( target_arch = "wasm32" ) ) ]
37
38
config. keepalive . as_ref ( ) ,
38
39
)
39
40
. await ?;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ use crate::codec::{BackendMessages, FrontendMessage};
2
2
use crate :: config:: SslMode ;
3
3
use crate :: connection:: { Request , RequestMessages } ;
4
4
use crate :: copy_out:: CopyOutStream ;
5
- #[ cfg( feature = "runtime" ) ]
5
+ #[ cfg( all ( feature = "runtime" , not ( target_arch = "wasm32" ) ) ) ]
6
6
use crate :: keepalive:: KeepaliveConfig ;
7
7
use crate :: query:: RowStream ;
8
8
use crate :: simple_query:: SimpleQueryStream ;
@@ -27,7 +27,7 @@ use std::collections::HashMap;
27
27
use std:: fmt;
28
28
#[ cfg( feature = "runtime" ) ]
29
29
use std:: net:: IpAddr ;
30
- #[ cfg( feature = "runtime" ) ]
30
+ #[ cfg( all ( feature = "runtime" , unix ) ) ]
31
31
use std:: path:: PathBuf ;
32
32
use std:: sync:: Arc ;
33
33
use std:: task:: { Context , Poll } ;
@@ -160,6 +160,7 @@ pub(crate) struct SocketConfig {
160
160
pub port : u16 ,
161
161
pub connect_timeout : Option < Duration > ,
162
162
pub tcp_user_timeout : Option < Duration > ,
163
+ #[ cfg( not( target_arch = "wasm32" ) ) ]
163
164
pub keepalive : Option < KeepaliveConfig > ,
164
165
}
165
166
Original file line number Diff line number Diff line change @@ -146,6 +146,7 @@ where
146
146
port,
147
147
config. connect_timeout ,
148
148
config. tcp_user_timeout ,
149
+ #[ cfg( not( target_arch = "wasm32" ) ) ]
149
150
if config. keepalives {
150
151
Some ( & config. keepalive_config )
151
152
} else {
@@ -216,6 +217,7 @@ where
216
217
port,
217
218
connect_timeout : config. connect_timeout ,
218
219
tcp_user_timeout : config. tcp_user_timeout ,
220
+ #[ cfg( not( target_arch = "wasm32" ) ) ]
219
221
keepalive : if config. keepalives {
220
222
Some ( config. keepalive_config . clone ( ) )
221
223
} else {
Original file line number Diff line number Diff line change 1
1
use crate :: client:: Addr ;
2
+ #[ cfg( not( target_arch = "wasm32" ) ) ]
2
3
use crate :: keepalive:: KeepaliveConfig ;
3
4
use crate :: { Error , Socket } ;
5
+ #[ cfg( not( target_arch = "wasm32" ) ) ]
4
6
use socket2:: { SockRef , TcpKeepalive } ;
5
7
use std:: future:: Future ;
6
8
use std:: io;
@@ -17,7 +19,7 @@ pub(crate) async fn connect_socket(
17
19
#[ cfg_attr( not( target_os = "linux" ) , allow( unused_variables) ) ] tcp_user_timeout : Option <
18
20
Duration ,
19
21
> ,
20
- keepalive_config : Option < & KeepaliveConfig > ,
22
+ # [ cfg ( not ( target_arch = "wasm32" ) ) ] keepalive_config : Option < & KeepaliveConfig > ,
21
23
) -> Result < Socket , Error > {
22
24
match addr {
23
25
Addr :: Tcp ( ip) => {
@@ -26,6 +28,7 @@ pub(crate) async fn connect_socket(
26
28
27
29
stream. set_nodelay ( true ) . map_err ( Error :: connect) ?;
28
30
31
+ #[ cfg( not( target_arch = "wasm32" ) ) ]
29
32
let sock_ref = SockRef :: from ( & stream) ;
30
33
#[ cfg( target_os = "linux" ) ]
31
34
{
@@ -34,6 +37,7 @@ pub(crate) async fn connect_socket(
34
37
. map_err ( Error :: connect) ?;
35
38
}
36
39
40
+ #[ cfg( not( target_arch = "wasm32" ) ) ]
37
41
if let Some ( keepalive_config) = keepalive_config {
38
42
sock_ref
39
43
. set_tcp_keepalive ( & TcpKeepalive :: from ( keepalive_config) )
You can’t perform that action at this time.
0 commit comments