Closed rogerjames99 closed 5 months ago
@rogerjames99
Commenting out return Ok(l);
in tcp.rs causes the TCP connection to close. In Rust, you can use the Result
enum for error handling:
enum Result<T, E> {
Ok(T),
Err(E),
}
This enum provides a way to handle errors. The function listen_any(port)
must return a Result<TcpListener, E>
, in other words, Ok(something)
, where something
is a TcpListener
. In your case, you’re not returning anything.
Sorry for the delay in replying to this. I have been unwell. I will have a look at this over the next few days. Once again I have no knowledge of the rust language.
The correct behaviour for handling IPv4 and IPv6 connections on linux systems is to open two listening sockets one bound to the IPv4 stack and the other to the IPv6 stack.
Once again I reiterate that I have zero knowledge of the Rust language. So this needs someone who knows rust Rust to look at the code areas I have highlighted and provide the code changes necessary to the acheive the correct behaviour. I will then remove my hacks from the pull request and resubmit it with the correct changes.
Mea culpa,
This pull request is currently nonsensensical.
I am closing it down.
On linux systems a single socket can listen to both IPv6 and IPv4 connections but only if a number of conditions are met.
If any of these conditions are not met then the socket will be not accept IPv4 connections.
N.B. Incoming IPv4 addresses will be mapped into IPv6 addresses using the standard rules.
This pull request is about fixing a problem in the open source version of rustdesk-server when run on a bare metal linux server. The problem manifests itself as the rendezvous server only listening on ipv6 ports. My lack of knowledge of the rust programming language means that while this pull request will build. However the rendezvous will fail connection requests with the following trace.
If only the patch in src/rendezvous_server.rs is applied then listening ports will be open on both ipv4 and ipv6. If the patch in libs/hbb_common/src/tcp.rs is applied as well then no ipv6 ports will be created at on either the rendezvous server or the relay server.
Please can this pull request be reviewed by someone who is familiar with rustdesk-server code.