all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH backup 1/2] examples: h2server: port to http2::Builder::new
@ 2025-03-14 12:45 Maximiliano Sandoval
  2025-03-14 12:45 ` [pbs-devel] [PATCH backup 2/2] examples: h2s-server: port to http2::builder::new Maximiliano Sandoval
  2025-03-17 12:51 ` [pbs-devel] applied-series: [PATCH backup 1/2] examples: h2server: port to http2::Builder::new Fabian Grünbichler
  0 siblings, 2 replies; 3+ messages in thread
From: Maximiliano Sandoval @ 2025-03-14 12:45 UTC (permalink / raw)
  To: pbs-devel

Fixes the deprecation warning while building this example.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 examples/h2server.rs | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/examples/h2server.rs b/examples/h2server.rs
index 678640e8..6b286e78 100644
--- a/examples/h2server.rs
+++ b/examples/h2server.rs
@@ -1,9 +1,24 @@
+use std::future::Future;
+
 use anyhow::Error;
 use futures::*;
 use hyper::{Body, Request, Response};
 
 use tokio::net::{TcpListener, TcpStream};
 
+#[derive(Clone, Copy)]
+struct H2Executor;
+
+impl<Fut> hyper::rt::Executor<Fut> for H2Executor
+where
+    Fut: Future + Send + 'static,
+    Fut::Output: Send,
+{
+    fn execute(&self, fut: Fut) {
+        tokio::spawn(fut);
+    }
+}
+
 fn main() -> Result<(), Error> {
     proxmox_async::runtime::main(run())
 }
@@ -26,12 +41,11 @@ async fn run() -> Result<(), Error> {
 async fn handle_connection(socket: TcpStream) -> Result<(), Error> {
     socket.set_nodelay(true).unwrap();
 
-    let mut http = hyper::server::conn::Http::new();
-    http.http2_only(true);
+    let mut http = hyper::server::conn::http2::Builder::new(H2Executor);
     // increase window size: todo - find optiomal size
     let max_window_size = (1 << 31) - 2;
-    http.http2_initial_stream_window_size(max_window_size);
-    http.http2_initial_connection_window_size(max_window_size);
+    http.initial_stream_window_size(max_window_size);
+    http.initial_connection_window_size(max_window_size);
 
     let service = hyper::service::service_fn(|_req: Request<Body>| {
         println!("Got request");
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pbs-devel] [PATCH backup 2/2] examples: h2s-server: port to http2::builder::new
  2025-03-14 12:45 [pbs-devel] [PATCH backup 1/2] examples: h2server: port to http2::Builder::new Maximiliano Sandoval
@ 2025-03-14 12:45 ` Maximiliano Sandoval
  2025-03-17 12:51 ` [pbs-devel] applied-series: [PATCH backup 1/2] examples: h2server: port to http2::Builder::new Fabian Grünbichler
  1 sibling, 0 replies; 3+ messages in thread
From: Maximiliano Sandoval @ 2025-03-14 12:45 UTC (permalink / raw)
  To: pbs-devel

Fixes the deprecation warning when building this example.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 examples/h2s-server.rs | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/examples/h2s-server.rs b/examples/h2s-server.rs
index 5a772802..0f4c0c14 100644
--- a/examples/h2s-server.rs
+++ b/examples/h2s-server.rs
@@ -8,6 +8,19 @@ use tokio::net::{TcpListener, TcpStream};
 
 use pbs_buildcfg::configdir;
 
+#[derive(Clone, Copy)]
+struct H2SExecutor;
+
+impl<Fut> hyper::rt::Executor<Fut> for H2SExecutor
+where
+    Fut: Future + Send + 'static,
+    Fut::Output: Send,
+{
+    fn execute(&self, fut: Fut) {
+        tokio::spawn(fut);
+    }
+}
+
 fn main() -> Result<(), Error> {
     proxmox_async::runtime::main(run())
 }
@@ -50,12 +63,11 @@ async fn handle_connection(socket: TcpStream, acceptor: Arc<SslAcceptor>) -> Res
 
     stream.as_mut().accept().await?;
 
-    let mut http = hyper::server::conn::Http::new();
-    http.http2_only(true);
+    let mut http = hyper::server::conn::http2::Builder::new(H2SExecutor);
     // increase window size: todo - find optiomal size
     let max_window_size = (1 << 31) - 2;
-    http.http2_initial_stream_window_size(max_window_size);
-    http.http2_initial_connection_window_size(max_window_size);
+    http.initial_stream_window_size(max_window_size);
+    http.initial_connection_window_size(max_window_size);
 
     let service = hyper::service::service_fn(|_req: Request<Body>| {
         println!("Got request");
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pbs-devel] applied-series: [PATCH backup 1/2] examples: h2server: port to http2::Builder::new
  2025-03-14 12:45 [pbs-devel] [PATCH backup 1/2] examples: h2server: port to http2::Builder::new Maximiliano Sandoval
  2025-03-14 12:45 ` [pbs-devel] [PATCH backup 2/2] examples: h2s-server: port to http2::builder::new Maximiliano Sandoval
@ 2025-03-17 12:51 ` Fabian Grünbichler
  1 sibling, 0 replies; 3+ messages in thread
From: Fabian Grünbichler @ 2025-03-17 12:51 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion

On March 14, 2025 1:45 pm, Maximiliano Sandoval wrote:
> Fixes the deprecation warning while building this example.
> 
> Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
> ---
>  examples/h2server.rs | 22 ++++++++++++++++++----
>  1 file changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/examples/h2server.rs b/examples/h2server.rs
> index 678640e8..6b286e78 100644
> --- a/examples/h2server.rs
> +++ b/examples/h2server.rs
> @@ -1,9 +1,24 @@
> +use std::future::Future;
> +
>  use anyhow::Error;
>  use futures::*;
>  use hyper::{Body, Request, Response};
>  
>  use tokio::net::{TcpListener, TcpStream};
>  
> +#[derive(Clone, Copy)]
> +struct H2Executor;
> +
> +impl<Fut> hyper::rt::Executor<Fut> for H2Executor
> +where
> +    Fut: Future + Send + 'static,
> +    Fut::Output: Send,
> +{
> +    fn execute(&self, fut: Fut) {
> +        tokio::spawn(fut);
> +    }
> +}
> +
>  fn main() -> Result<(), Error> {
>      proxmox_async::runtime::main(run())
>  }
> @@ -26,12 +41,11 @@ async fn run() -> Result<(), Error> {
>  async fn handle_connection(socket: TcpStream) -> Result<(), Error> {
>      socket.set_nodelay(true).unwrap();
>  
> -    let mut http = hyper::server::conn::Http::new();
> -    http.http2_only(true);
> +    let mut http = hyper::server::conn::http2::Builder::new(H2Executor);
>      // increase window size: todo - find optiomal size
>      let max_window_size = (1 << 31) - 2;
> -    http.http2_initial_stream_window_size(max_window_size);
> -    http.http2_initial_connection_window_size(max_window_size);
> +    http.initial_stream_window_size(max_window_size);
> +    http.initial_connection_window_size(max_window_size);
>  
>      let service = hyper::service::service_fn(|_req: Request<Body>| {
>          println!("Got request");
> -- 
> 2.39.5
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
> 
> 
> 


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-17 12:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-14 12:45 [pbs-devel] [PATCH backup 1/2] examples: h2server: port to http2::Builder::new Maximiliano Sandoval
2025-03-14 12:45 ` [pbs-devel] [PATCH backup 2/2] examples: h2s-server: port to http2::builder::new Maximiliano Sandoval
2025-03-17 12:51 ` [pbs-devel] applied-series: [PATCH backup 1/2] examples: h2server: port to http2::Builder::new Fabian Grünbichler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal