@@ -299,6 +299,37 @@ impl Multi {
299
299
self . setopt_long ( curl_sys:: CURLMOPT_MAX_HOST_CONNECTIONS , val as c_long )
300
300
}
301
301
302
+ /// Sets the max simultaneously open connections.
303
+ ///
304
+ /// The set number will be used as the maximum number of simultaneously open
305
+ /// connections in total using this multi handle. For each new session,
306
+ /// libcurl will open a new connection up to the limit set by the provided
307
+ /// value. When the limit is reached, the sessions will be pending until
308
+ /// there are available connections. If pipelining is enabled, libcurl will
309
+ /// try to pipeline or use multiplexing if the host is capable of it.
310
+ pub fn set_max_total_connections ( & mut self , val : usize ) -> Result < ( ) , MultiError > {
311
+ self . setopt_long ( curl_sys:: CURLMOPT_MAX_TOTAL_CONNECTIONS , val as c_long )
312
+ }
313
+
314
+ /// Set size of connection cache.
315
+ ///
316
+ /// The set number will be used as the maximum amount of simultaneously open
317
+ /// connections that libcurl may keep in its connection cache after
318
+ /// completed use. By default libcurl will enlarge the size for each added
319
+ /// easy handle to make it fit 4 times the number of added easy handles.
320
+ ///
321
+ /// By setting this option, you can prevent the cache size from growing
322
+ /// beyond the limit set by you.
323
+ ///
324
+ /// When the cache is full, curl closes the oldest one in the cache to
325
+ /// prevent the number of open connections from increasing.
326
+ ///
327
+ /// See [`set_max_total_connections`](#method.set_max_total_connections) for
328
+ /// limiting the number of active connections.
329
+ pub fn set_max_connects ( & mut self , val : usize ) -> Result < ( ) , MultiError > {
330
+ self . setopt_long ( curl_sys:: CURLMOPT_MAXCONNECTS , val as c_long )
331
+ }
332
+
302
333
/// Sets the pipeline length.
303
334
///
304
335
/// This sets the max number that will be used as the maximum amount of
@@ -673,6 +704,11 @@ impl Multi {
673
704
pub fn close ( & self ) -> Result < ( ) , MultiError > {
674
705
unsafe { cvt ( curl_sys:: curl_multi_cleanup ( self . raw ) ) }
675
706
}
707
+
708
+ /// Get a pointer to the raw underlying CURLM handle.
709
+ pub fn raw ( & self ) -> * mut curl_sys:: CURLM {
710
+ self . raw
711
+ }
676
712
}
677
713
678
714
fn cvt ( code : curl_sys:: CURLMcode ) -> Result < ( ) , MultiError > {
0 commit comments