Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support build on wasm32#1146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
L-jasmine wants to merge1 commit intorust-postgres:master
base:master
Choose a base branch
Loading
fromL-jasmine:fix/wasm32
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletionstokio-postgres/src/cancel_query.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,6 +34,7 @@ where
config.port,
config.connect_timeout,
config.tcp_user_timeout,
#[cfg(not(target_arch = "wasm32"))]
config.keepalive.as_ref(),
)
.await?;
Expand Down
5 changes: 3 additions & 2 deletionstokio-postgres/src/client.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@ use crate::codec::{BackendMessages, FrontendMessage};
use crate::config::SslMode;
use crate::connection::{Request, RequestMessages};
use crate::copy_out::CopyOutStream;
#[cfg(feature = "runtime")]
#[cfg(all(feature = "runtime", not(target_arch = "wasm32")))]
use crate::keepalive::KeepaliveConfig;
use crate::query::RowStream;
use crate::simple_query::SimpleQueryStream;
Expand All@@ -27,7 +27,7 @@ use std::collections::HashMap;
use std::fmt;
#[cfg(feature = "runtime")]
use std::net::IpAddr;
#[cfg(feature = "runtime")]
#[cfg(all(feature = "runtime", unix))]
use std::path::PathBuf;
use std::sync::Arc;
use std::task::{Context, Poll};
Expand DownExpand Up@@ -160,6 +160,7 @@ pub(crate) struct SocketConfig {
pub port: u16,
pub connect_timeout: Option<Duration>,
pub tcp_user_timeout: Option<Duration>,
#[cfg(not(target_arch = "wasm32"))]
pub keepalive: Option<KeepaliveConfig>,
}

Expand Down
2 changes: 2 additions & 0 deletionstokio-postgres/src/connect.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -146,6 +146,7 @@ where
port,
config.connect_timeout,
config.tcp_user_timeout,
#[cfg(not(target_arch = "wasm32"))]
if config.keepalives {
Some(&config.keepalive_config)
} else {
Expand DownExpand Up@@ -216,6 +217,7 @@ where
port,
connect_timeout: config.connect_timeout,
tcp_user_timeout: config.tcp_user_timeout,
#[cfg(not(target_arch = "wasm32"))]
keepalive: if config.keepalives {
Some(config.keepalive_config.clone())
} else {
Expand Down
6 changes: 5 additions & 1 deletiontokio-postgres/src/connect_socket.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
use crate::client::Addr;
#[cfg(not(target_arch = "wasm32"))]
use crate::keepalive::KeepaliveConfig;
use crate::{Error, Socket};
#[cfg(not(target_arch = "wasm32"))]
use socket2::{SockRef, TcpKeepalive};
use std::future::Future;
use std::io;
Expand All@@ -17,7 +19,7 @@ pub(crate) async fn connect_socket(
#[cfg_attr(not(target_os = "linux"), allow(unused_variables))] tcp_user_timeout: Option<
Duration,
>,
keepalive_config: Option<&KeepaliveConfig>,
#[cfg(not(target_arch = "wasm32"))]keepalive_config: Option<&KeepaliveConfig>,
) -> Result<Socket, Error> {
match addr {
Addr::Tcp(ip) => {
Expand All@@ -26,6 +28,7 @@ pub(crate) async fn connect_socket(

stream.set_nodelay(true).map_err(Error::connect)?;

#[cfg(not(target_arch = "wasm32"))]
let sock_ref = SockRef::from(&stream);
#[cfg(target_os = "linux")]
{
Expand All@@ -34,6 +37,7 @@ pub(crate) async fn connect_socket(
.map_err(Error::connect)?;
}

#[cfg(not(target_arch = "wasm32"))]
if let Some(keepalive_config) = keepalive_config {
sock_ref
.set_tcp_keepalive(&TcpKeepalive::from(keepalive_config))
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp