Skip to content

Cave falsely assumes it is offline #15

Description

@ClementPhan

Encountered behaviour

Cave checks if it is online but fails the test. There is, however, an active internet connection.

Expected behaviour

Cave should work with an existing connection. There should be a more robust connection test or a override option.

Troubleshooting

I believe the test comes from the following snippet, but is is too stringent.

cave/src/manage.rs

Lines 344 to 350 in 9221c17

fn internet_available() -> bool {
TcpStream::connect_timeout(
&"8.8.8.8:53".parse().unwrap(), // Google DNS
Duration::from_secs(2),
)
.is_ok()
}

I have tried to replicate it through the console :

ClementPhan:~$ cave list
  17.3.1
ClementPhan:~$ cave available
Error: No internet connection detected. Please check your network and try again.
ClementPhan:~$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=106 time=16.2 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=106 time=17.0 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=106 time=16.3 ms
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 16.222/16.487/16.952/0.329 ms
ClementPhan:~$ netcat -v 8.8.8.8 53
netcat: connect to 8.8.8.8 port 53 (tcp) failed: Connection timed out

ClementPhan:~$ netcat -v google.com 80
Connection to google.com (172.217.22.110) 80 port [tcp/http] succeeded!
^C

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions