I'm trying to init the listener with the following options (from arguments)
let session = librqbit::Session::new_with_opts(
match preload {
Some(ref p) => p.path(),
None => PathBuf::new(),
},
SessionOptions {
listen: Some(match config.listen {
Some(l) => ListenerOptions {
listen_addr: std::net::SocketAddr::from_str(&l)?,
enable_upnp_port_forwarding: config.listen_upnp,
..ListenerOptions::default()
},
None => ListenerOptions {
enable_upnp_port_forwarding: config.listen_upnp,
..ListenerOptions::default()
},
}),
...
In this case, when the listen_addr is not provided (None) I have following error:
Error: error starting listeners
Caused by:
you must set the listen port explicitly
The ..ListenerOptions::default() should autocomplete default values, or that's not yet implemented and autoinit works only when the entire listen member is None?
I would like to return None but on example above I have enable_upnp_port_forwarding handler, so can't simply return the None for entire struct. As the solution, I think we can make listen_addr accepting None values, or maybe make it as optional array, for multi-binding ability.
- also, thoughts about the
None value for the first librqbit::Session::new_with_opts argument (PathBuf) - I provide empty path there, but it could be None instead.
I'm trying to init the listener with the following options (from arguments)
In this case, when the
listen_addris not provided (None) I have following error:Error: error starting listeners Caused by: you must set the listen port explicitlyThe
..ListenerOptions::default()should autocomplete default values, or that's not yet implemented and autoinit works only when the entirelistenmember isNone?I would like to return
Nonebut on example above I haveenable_upnp_port_forwardinghandler, so can't simply return theNonefor entire struct. As the solution, I think we can makelisten_addracceptingNonevalues, or maybe make it as optional array, for multi-binding ability.Nonevalue for the firstlibrqbit::Session::new_with_optsargument (PathBuf) - I provide empty path there, but it could beNoneinstead.