chiark / gitweb /
max_batch_up: Make it a limit on the server
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 8 Aug 2021 13:36:40 +0000 (14:36 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 8 Aug 2021 13:36:40 +0000 (14:36 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
PROTOCOL
docs/settings.rst
src/bin/client.rs
src/config.rs

index b39253be7f99af8e4f164f22fa190aaea0c23a4c..cb31035d637a7e11cc02ab75fd5938b36a4c03d4 100644 (file)
--- a/PROTOCOL
+++ b/PROTOCOL
@@ -23,6 +23,7 @@ Client form parameters (multipart/form-data):
                        target_requests_outstanding
                        http_timeout
                        max_batch_down
+                       max_batch_up
  d              data (SLIP format, with SLIP_ESC and `-' swapped)
 
 
index 8a07983cb28a94508087cf445fd2f1fc2acaafe6..6bf171210353a0d22c6db116bad3ec196d0121b0 100644 (file)
@@ -67,11 +67,20 @@ value is obtained, it is (silently) reduced to the limit value.
 
   On client, incoming response bodies are limited to this plus
   a fixed constant metadata overhead of 10000 bytes.
-  Server uses minimum of client and server value (old servers
-  just uses server's value).
+  Server uses minimum of client's and server's configured values
+  (old servers just use server's value).
 
   [``65536`` (bytes); ``LIMIT``: ``262144``]
 
+``max_batch_up``
+  Size limit for request upbound payloads.  On client, used directly,
+  with ``LIMIT`` applied.
+
+  On server, only ``LIMIT`` is relevant, and must be at least the
+  client's configured value (checked). xxx put in metadata
+
+  [``4000`` (bytes); ``LIMIT``: ``262144``]
+
 ``max_queue_time``
   Discard packets after they have been queued this long
   waiting for http.
@@ -170,9 +179,6 @@ Ordinary settings, used by client only
   Client will hold off sending more requests than this to
   server even if it has data to send.  [``6``]
 
-``max_batch_up``
-  Size limit for request upbound payloads. [``4000`` (bytes)]
-
 ``success_report_interval``
   If nonzero, report success periodically.  Otherwise just
   report it when we first have success.  [``3600`` (s)]
index b57d7722caa8d443e4e32171fa5350236836e0d7..d5fce6fb2b8f45ab643dd15f1743a6be0e76dbbc 100644 (file)
@@ -68,12 +68,14 @@ fn submit_request<'r, 'c:'r, C:HCC>(
        {}
        {}
        {}
+       {}
        {}"#),
                        &c.ic.link.client,
                        token,
                        c.ic.target_requests_outstanding,
                        show_timeout,
                        c.ic.max_batch_down,
+                       c.ic.max_batch_up,
   );
 
   let prefix2 = format!(into_crlfs!(
index b439e4af1c56f32151dfffa40024f124b93f385a..41ae047fc3b5250d114f4cda7e11700508caf310 100644 (file)
@@ -17,6 +17,7 @@ pub struct InstanceConfig {
   #[limited]    pub max_queue_time:               Duration,
   #[limited]    pub http_timeout:                 Duration,
   #[limited]    pub target_requests_outstanding:  u32,
+  #[special(special_max_up, SKL::PerClient)]  pub max_batch_up: u32,
 
   // Ordinary settings, used by both, not client-specifi:
   #[global]  pub addrs:                        Vec<IpAddr>,
@@ -33,7 +34,6 @@ pub struct InstanceConfig {
   // Ordinary settings, used by client only:
   #[client]  pub http_timeout_grace:           Duration,
   #[client]  pub max_requests_outstanding:     u32,
-  #[client]  pub max_batch_up:                 u32,
   #[client]  pub http_retry:                   Duration,
   #[client]  pub success_report_interval:      Duration,
   #[client]  pub url:                          Uri,
@@ -68,6 +68,7 @@ mtu = 1500
 vnetwork = 172.24.230.192
 
 [LIMIT]
+max_batch_up = 262144
 max_batch_down = 262144
 max_queue_time = 121
 http_timeout = 121
@@ -684,6 +685,15 @@ impl<'c> ResolveContext<'c> {
     assert_eq!(skl, SKL::None);
     self.link.clone()
   }
+
+  #[throws(AE)]
+  pub fn special_max_up(&self, key: &'static str, skl: SKL) -> u32 {
+    assert_eq!(skl, SKL::None);
+    match self.end {
+      LinkEnd::Client => self.ordinary(key, SKL::PerClient)?,
+      LinkEnd::Server => self.ordinary(key, SKL::Limits)?,
+    }
+  }
 }
 
 impl InstanceConfig {