-
Notifications
You must be signed in to change notification settings - Fork 152
Error starting listeners with ListenerOptions::default() autocompletion #454
Copy link
Copy link
Closed
Description
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 explicitlyThe ..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
Nonevalue for the firstlibrqbit::Session::new_with_optsargument (PathBuf) - I provide empty path there, but it could beNoneinstead.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels